需要在每个菜单页面设置属性状态
onShow: function () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
selected: 0
})
}
}
博客提到需在每个菜单页面设置属性状态,并给出了相关代码示例,通过 onShow 函数判断是否能获取 TabBar 并设置其选中状态为 0。
需要在每个菜单页面设置属性状态
onShow: function () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
selected: 0
})
}
}
1754
700
1638
1万+
363

被折叠的 条评论
为什么被折叠?