欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

VUE Tabbar重复点击报错问题

程序员文章站 2022-03-25 11:15:23
...

Tabbar重复点击报错问题

问题: 当我们重复点击底部导航是控制台回报错
VUE Tabbar重复点击报错问题

报错: VUE Tabbar重复点击报错问题

解决方法:router.js加以下代码

//router.push方法
  const originalPush = VueRouter.prototype.push;
  VueRouter.prototype.push = function(location) {
    return originalPush.call(this, location).catch(err => err);
  };
  
//router.replace方法
  const originalReplace = VueRouter.prototype.replace;
  VueRouter.prototype.replace = function replace(location) {
    return originalReplace.call(this, location).catch(err => err);
}
相关标签: vue VueRouter