微信小程序在底部导航加未读消息或红点

未读消息

注意⚠️:在tabBar页使用api,当前的页面不是TabBar 页面,就会报错,index为tabBar 的哪一项,从左边算起,text为字符串
显示

wx.setTabBarBadge({
    
    
   index: 3,
   text: '3'
}); 

去掉

 wx.removeTabBarBadge({
    
    
    index: 3
});

红点

显示

wx.showTabBarRedDot({
    
    
   index: 3,
}); 

隐藏

wx.hideTabBarRedDot({
    
    
  index: 3,
}); 

猜你喜欢

转载自blog.csdn.net/qq_1296888290/article/details/111950229