Vue中路由重复点击报错?Vue中路由重复点击报错如何解决?

236 阅读1分钟

Vue中路由重复点击报错如何解决?

解决方案有多种

第一种方案:

使用旧版本的VueRouter3.0.xxx 的

第二种方案:

在如有中,配置路由跳转,在router中的index.js中加上以下代码,注意加在use之前。

const originalPush = VueRouter.prototype.push;

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

image.png image.png