NavigationDuplicated: Avoided redundant navigation to current location: “/“
当遇到NavigationDuplicated: Avoided redundant navigation to current location: “/” 的时候
如下图
翻译之后就是 :navigationduplicate:避免到当前位置的冗余导航:"/"
原因是因为 :是指路由重复。虽然对项目无影响,但是看到有红的不舒服!
解决:打开router文件夹下的index.js文件中添加如下代码:
// 获取原型对象的push函数
const originalPush = VueRouter.prototype.push
// 修改 原型对象中的push方法
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err=>err)
}
刷新页面就可以了。