I\'m new to vuejs and I\'m working on my first project with vue. I\'m just wondering how I will route to my 404.vue component when the requested url is not found.
An
Now in Vue 3 path: '*'
will not work. we have to use regex: /:catchAll(.*)
We can use directly instead of using path: "*"
{
// path: "*",
path: "/:catchAll(.*)",
name: "NotFound",
component:NotFound,
}
or
{
path: '/404', name: 'NotFound', component: NotFound
},
{
path: '/:catchAll(.*)', redirect:'404'
}
I got it from here