https://router.vuejs.org/guide/migration/index.html#moved-the-base-option
{
path: '/:pathMatch(.*)',
name: 'NotFound',
hidden: true,
component: () => import('@/views/notFound/not-found.vue'),
}
router.beforeEach((to, from, next) => {
const isValidRoute = router.options.routes.some(route => route.path === to.path);
if (isValidRoute) {
next(); // Route exists, continue navigating to the target route
} else {
next({ name: 'NotFound' }); // Route does not exist, redirect to the 404 page or other error page
}
});