VUE控制台报错: [vue-router] Duplicate named routes definition: { name: "NotFound", path: "*" }
将下面写法
{
path: "*",
name: 'NotFound',
redirect: "/404"
}
改为
{
path: "*",
redirect: {
name: 'NotFound',
}
}
本文详细介绍了在Vue项目中遇到的路由重复定义错误:[vue-router]Duplicate named routes definition。通过修改NotFound路由的配置,从直接使用name属性到利用redirect属性指向目标路由,成功解决了该问题。
VUE控制台报错: [vue-router] Duplicate named routes definition: { name: "NotFound", path: "*" }
将下面写法
{
path: "*",
name: 'NotFound',
redirect: "/404"
}
改为
{
path: "*",
redirect: {
name: 'NotFound',
}
}
1万+
949
1168
2866

被折叠的 条评论
为什么被折叠?
