Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location

叁歲伎倆 2022-12-15 11:20 303阅读 0赞

报错
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location

解决办法
在路由文件中加入如下代码,即可解决

  1. import VueRouter from "vue-router";
  2. //push
  3. const VueRouterPush = VueRouter.prototype.push
  4. VueRouter.prototype.push = function push (to) {
  5. return VueRouterPush.call(this, to).catch(err => err)
  6. }
  7. //replace
  8. const VueRouterReplace = VueRouter.prototype.replace
  9. VueRouter.prototype.replace = function replace (to) {
  10. return VueRouterReplace.call(this, to).catch(err => err)
  11. }

发表评论

表情:
评论列表 (有 0 条评论,303人围观)

还没有评论,来说两句吧...

相关阅读