vue项目router报NavigationDuplicated: Avoided redundant navigation to current location: "/result/3"错误
写vue项目,重复点击路由会在控制台报如下错误
它的提示是 避免到当前位置的冗余导航。 简单来说就是重复触发了同一个路由。
解决:在router/index里加如下代码就可以了
const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }
就是这个位置
ok,错误解决!