{errMsg: "setTabBarBadge:fail not TabBar page"}
代码如下
wx.setTabBarBadge({
index: 0,
text: '3',
success: function (res){
console.log(res)
},
fail: function (res) {
console.log(res)
}
})
"tabBar": {
"color": "#666",
"selectedColor": "#dd524d",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "resources/images/icon/first.png",
"selectedIconPath": "resources/images/icon/first_se.png",
"text": "首页"
},
{
"pagePath": "pages/cart/cart",
"iconPath": "resources/images/icon/cart.png",
"selectedIconPath": "resources/images/icon/cart_se.png",
"text": "购物车"
},
{
"pagePath": "pages/mine/mine",
"iconPath": "resources/images/icon/mine.png",
"selectedIconPath": "resources/images/icon/mine_se.png",
"text": "我的"
}
]
}
你好,是没有在TabBar页面调用api?麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
是的,没有tabbar的页面不能调用吗? 默认的组件是不是就没有角标的相关功能
是的,目前的设计是这样的,后续也可以经过搜索找答案
wx.setTabBarBadger报错
https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=0008c8ff0c0020783eb6d099e51c00&highline=wx.setTabBarBadge