You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
406 B

import {
mapGetters
} from "vuex"
export default {
computed: {
...mapGetters(['badgeNum']),
},
onShow() {
this.setTabBarBadge()
},
methods: {
setTabBarBadge() {
const badgeNum = this.badgeNum
if (badgeNum) {
uni.setTabBarBadge({
index: 3,
text: badgeNum > 99 ? '99+' : badgeNum.toString()
});
} else {
uni.removeTabBarBadge({
index: 3
});
}
}
}
}