VUE Tabbar重复点击报错问题
程序员文章站
2022-03-25 11:15:23
...
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);
}