mirror of
https://gitee.com/myxzgzs/boyue_jnpf.git
synced 2025-08-09 15:52:42 +08:00
24 lines
423 B
JavaScript
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
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|