tabbar添加右上角提示数量可以通过:wx.setTabBarBadge来进行设置
doAddTabBarBadge(){
//添加商品后通过wx.setTabBarBadge来进行设置
wx.setTabBarBadge({//tabbar右上角添加文本
index: 2,//tabbar下标
text: this.data.num //显示的内容,必须为字符串可通过toString()将number转为字符串
})
} tabbar移除右上角提示数量可以通过:wx.removeTabBarBadge来进行设置
doRemoveTabBarBadge(){
//如果还未添加商品时候,可使用这个wx.removeTabBarBadge来移除
wx.removeTabBarBadge({//移除tabbar右上角的文本
index: 2,//tabbar下标
})
}