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.
29 lines
441 B
29 lines
441 B
export default{
|
|
computed: {
|
|
cartCount(){
|
|
return this.$store.state.cartCount;
|
|
}
|
|
},
|
|
watch: {
|
|
cartCount(count){
|
|
this.resetTabCartCount();
|
|
}
|
|
},
|
|
onShow(){
|
|
this.resetTabCartCount();
|
|
},
|
|
methods: {
|
|
resetTabCartCount(){
|
|
if(this.cartCount > 0){
|
|
uni.setTabBarBadge({
|
|
index: 2,
|
|
text: '' + this.cartCount
|
|
})
|
|
}else{
|
|
uni.removeTabBarBadge({
|
|
index: 2
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|