错误:
const notFound = () => import('@views/404/404.vue')
{
path: '*',
name: '404',
component: notFound
}
根据报错信息可得 必须使用正则表达式
解决方案:
const notFound = () => import('@views/404/404.vue')
{
// 匹配所有路径 vue2使用* vue3使用/:pathMatch(.*)*或/:pathMatch(.*)或/:catchAll(.*)
path: "/:pathMatch(.*)*",
name: "404",
component: notFound
}