微信小程序底部Tabbar增加角标显示

根据微信提供的API wx.setTabBarBadge进行角标的设置;

api地址:https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html

	let cartNum = 2;  //默认数据
		if (cartNum.length != 0) {
    
    
			//设置角标
			wx.setTabBarBadge({
    
    
				index: 1, //第几个tab
				text: cartNum.toString()
			})
		} else {
    
    
			//移除角标
			wx.removeTabBarBadge({
    
    
				index: 1,
			})
		}

猜你喜欢

转载自blog.csdn.net/qq_36229632/article/details/117110807