diff --git a/App.vue b/App.vue index f9aa300..fd89ed0 100644 --- a/App.vue +++ b/App.vue @@ -283,9 +283,13 @@ export default { text: String(res.approvePassHasNotRed), }); } else { - uni.removeTabBarBadge({ - index: 2, - }); + try { + uni.removeTabBarBadge({ + index: 2, + }); + } catch (error) { + console.log("当前页面不是 TabBar 页面,无法移除 badge"); + } } }); } diff --git a/pages/person/index.vue b/pages/person/index.vue index bf09582..b85e60e 100644 --- a/pages/person/index.vue +++ b/pages/person/index.vue @@ -764,9 +764,13 @@ export default { }); that.readed = false; } else { - uni.removeTabBarBadge({ - index: 2, - }); + try { + uni.removeTabBarBadge({ + index: 2, + }); + } catch (error) { + console.log("当前页面不是 TabBar 页面,无法移除 badge"); + } that.readed = true; } });