If there is no vue routing params, how can I jump to 404 in batches?

/ goods/:id
/ user/:id
if id does not exist, how can I jump to 404 or other pages?
it will not be linked normally. What if the id result on url does not have this id?

I will ask for details when I am in created (). You can judge here to jump if not.
but I have a lot of such routes. Do I have to judge each one?

Mar.05,2021

const router = new VueRouter ({.})

router.beforeEach ((to, from, next) = > {
/.
})


use beforeRouteUpdate, portal: https://router.vuejs.org/zh-c.

const User = {
  template: '...',
  beforeRouteUpdate (to, from, next) {
    // react to route changes...
    // don't forget to call next()
  }
}

1. Reference permission token check
router.beforeEach ((to, from, next) = > {

   if (to.meta.requireAuth) {
       if (store.state.token) {
            next();
        }
    }else {
        next({
            path: '/login',
            query: {redirect:to.fullPath}  
        })
    }
}
else {
    next();
}

})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a511-4d8a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a511-4d8a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?