路由多次跳转统一页面发生错误

当多次点击跳转时,可能会发生以下的报错

 主要时因为 多次跳转的路由重复了

解决方法:在router配置js文件中加入这样的一行代码

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

这样就可以不管多次跳转都不会报错了

猜你喜欢

转载自blog.csdn.net/m0_70547044/article/details/128178677