微信小程序自定义tabbar点击错乱

116 阅读1分钟

在对应bar的index页面中的onshow里面加上这段话,selected对应的就是当前bar的索引

if (typeof this.getTabBar === 'function' &&
        this.getTabBar()) {
            this.getTabBar().setData({
                selected: 0
            })
  }