VUE Tabbar重複點選報錯問題
阿新 • • 發佈:2021-02-20
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);
}