Avoided redundant navigation to current location: "/users"

Avoided redundant navigation to current location: "/users"

问题产生的原因:在Vue导航菜单中,重复点击一个菜单,即重复触发一个相同的路由,会报错,但不影响功能

 

解决:在router的配置文件中加入如下代码:


const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}

 

上一篇:vue报错:Avoided redundant navigation to current location: "/"的解决方法


下一篇:VueRouter路由跳转报错vue-router.esm.js?fe87:1958 Uncaught (in promise) NavigationDuplicated: Avoided redun