报错:
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
解决办法:
在路由文件中加入如下代码,即可解决
import VueRouter from "vue-router";
//push
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
return VueRouterPush.call(this, to).catch(err => err)
}
//replace
const VueRouterReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (to) {
return VueRouterReplace.call(this, to).catch(err => err)
}