尚品汇后台管理项目:vue-router.esm.js?8c4f:16 [vue-router] Duplicate named routes definition 警告处理方案
问题描述:切换路由时控制台不断弹出警告 vue-router.esm.js?8c4f:16 [vue-router] Duplicate named routes definition

使用后还会报 404 重复的问题

因为router--index.js中有两处使用了404 name,修改任意一处就能解决问题
export const constantRoutes = [{
{
path: '/404',
name: '404',
component: () => import('@/views/404'),
hidden: true
}
]
// 错误路由:当路径出现错误的时候重定向至404
export const anyRoutes = [
// 404 页面必须在最后
{ path: '*', name: '错误页面', redirect: '/404', hidden: true }
]
至此问题完美解决,控制台又是干干净净的啦

浙公网安备 33010602011771号