vue项目浏览器出现的警告信息:[vue-router] Duplicate named routes definition: { name: “index“, path: “/index“ }
那是因为路由这样写的改成这样即可:{path: '',redirect: {name: 'index',},},{path: '/index',component: (resolve) => require(['@/views/index'], resolve),name: 'index',meta: { title: '首页', noCache: true, affix: true },.
·
那是因为路由这样写的(出现重复):
{
path: '',
redirect: 'index',
component: (resolve) => require(['@/views/index'], resolve),
name: 'index',
meta: { title: '首页', noCache: true, affix: true },
hidden: true
},
{
path: '/index',
component: (resolve) => require(['@/views/index'], resolve),
name: 'index',
meta: { title: '首页', noCache: true, affix: true },
hidden: true
},
改成这样即可:
{
path: '',
redirect: {
name: 'index',
},
},
{
path: '/index',
component: (resolve) => require(['@/views/index'], resolve),
name: 'index',
meta: { title: '首页', noCache: true, affix: true },
hidden: true
},
更多推荐
已为社区贡献8条内容
所有评论(0)