以上的那种错误,就是当重复点击一个路由的时候,报出这种错误;

修复方法:在router.js中添加这一段代码就好啦;

因为这是重写路由的push方法---->这个是vue-cli4.x以上的坑

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function(location, onResolve, onReject) {

  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)

  return originalPush.call(this, location).catch(err => err)

}

 

posted on 2020-08-24 15:28  小名香菜~  阅读(428)  评论(0编辑  收藏  举报