使用 Element-ui 的导航,重复点击一个导航,报错信息如下:
Uncaught (in promise) Error: Avoided redundant navigation to current location: "/xxx/xxx/xxx"
(看网上说的是:vue-router 3.0 以上会出现这个报错)
解决方法如下:
在项目路由配置文件里面加上如下代码:
Router.prototype.push = function push(location) {
return Router.prototype.push.call(this, location).catch(err => err)
}