vue3.0使用vue-router4.0配置路由* 404页面,控制台报错:
在Vue3中配置path* 为404页面时,如下配置时,会报错
{
path: '*',
name: '404',
component: () => import('@/view/404')
}
控制台报错:
Error: Catch all routes ("*") must now be defined using a param with a custom regexp.
解决办法:
{
path: '/404',
name: '404',
component: () => import('@/view/404')
},
{
path: '/:pathMatch(.*)',
redirect: '/404'
}