它的提示是 避免到当前位置的冗余导航。 简单来说就是重复触发了同一个路由。
解决方法如下:
在router文件夹下的index.js文件中添加这几行代码即可:
const originalPush = Router.prototype.push
//解决报错信息:NavigationDuplicated: Avoided redundant navigation to current location
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
详细位置如下:
参考链接:https://blog.csdn.net/luer_LJS/article/details/108362563
但是吧,他用的不是Router而是VueRouter,不知道是不是vue-router版本的问题。