情况一 如果你的tabbar对应的页面是component,那就在component下面加上
其中的selected是该tab页面对应的索引值
pageLifetimes: {
show() {
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 4
})
}
}
},
情况二 如果你的tabbar对应的页面是page,那就将上面的if判断写在page的onshow里面
闪动问题就解决啦~