How to implement vue router 404

how does vue-router jump 404 requests that are not in the routing table?

Jun.13,2022

clipboard.png


after using the history mode, you need to cover all the routes in the Vue application, and then give a 404 page.

const router = new VueRouter({
  mode: 'history',
  routes: [
    { path: '*', component: NotFoundComponent }
  ]
})
Menu