重复点击vue路由报错

在引入vue-router的js文件里加上如下代码:

//push
const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err);
};

//replace
const VueRouterReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(to) {
  return VueRouterReplace.call(this, to).catch(err => err);
};

posted @ 2020-10-16 15:51  少年。  阅读(168)  评论(0编辑  收藏  举报