VUE router 导航重复点击报错的问题解决方案

使用的是 vue 3.0 在导航部分重复点击报错

报错信息如图

Avoided redundant navigation to current location:  避免了对当前位置的冗余导航
 

其实无伤大雅,不影响操作的。

 

百度了解决方案,在 route.js 中添加以下代码

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

 

然后就🆗了

 

posted @ 2020-06-20 15:24  _whys  阅读(1954)  评论(1编辑  收藏  举报