python学习
This commit is contained in:
22
native/utils/tools.js
Normal file
22
native/utils/tools.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// 显示购物车tabBar的Badge
|
||||
function showTabBarBadge(){
|
||||
wx.getStorage({
|
||||
key: 'shopCarInfo',
|
||||
success: function (res) {
|
||||
if (res.data.shopNum > 0) {
|
||||
wx.setTabBarBadge({
|
||||
index: 2,
|
||||
text: `${res.data.shopNum}`
|
||||
});
|
||||
} else {
|
||||
wx.removeTabBarBadge({
|
||||
index: 2
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
showTabBarBadge: showTabBarBadge
|
||||
}
|
||||
Reference in New Issue
Block a user