报错原因:多次点击同一路由,导致路由被多次添加
解决方法:

router/index中添加以下代码:

//router/index.js
Vue.use(VueRouter) //导入vue路由
const VueRouterPush = VueRouter.prototype.push 
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

之后就不会再报路由错误了

参考自:https://www.jianshu.com/p/a140ad42ef00

以上。

相关文章:

  • 2021-09-14
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-01-30
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-10-22
  • 2022-02-06
  • 2022-12-23
相关资源
相似解决方案