2025-06-30 09:38:03 +08:00

24 lines
423 B
JavaScript

import {
useChatStore
} from '@/store/modules/chat'
export default {
onShow() {
this.setTabBarBadge()
},
methods: {
setTabBarBadge() {
const chatStore = useChatStore()
const badgeNum = chatStore.getBadgeNum || 0
if (badgeNum) {
uni.setTabBarBadge({
index: 3,
text: badgeNum > 99 ? '99+' : badgeNum.toString()
});
} else {
uni.removeTabBarBadge({
index: 3
});
}
}
}
}