- vue路由報錯:
Uncaught (in promise) Error: Avoided redundant navigation to current location- 原因:
多次點(diǎn)擊跳轉(zhuǎn)同一個路由是不被允許的- 解決辦法:
在引入vue-router的js文件里加上如下代碼即可:
//push
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
return VueRouterPush.call(this, to).catch(err => err)
}
//replace
const VueRouterReplace = Router.prototype.replace
Router.prototype.replace = function replace (to) {
return VueRouterReplace.call(this, to).catch(err => err)
}
參考:https://blog.csdn.net/qq_30071415/article/details/106334953