问题描述:重复点击导航时,控制台报错,不影响使用但是,看着不舒服。
解决办法:
// 解决vue-router报NavigationDuplicated: Avoided redundant navigation to current location 的问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
};
const originalReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace=function replace(location) {
return originalReplace.call(this,location).catch(err => err)
};