- Custom navigation component is introduced after each TAB page index.vue writes the following method can be solved (note the method writes the top)
if ( typeof this.$root.$mp.page.getTabBar === "function" && this.$root.$mp.page.getTabBar() ) { This.$root.$mp.page. GetTabBar ().setData({activeIndex: 0 // index of the corresponding page}); }Copy the code
- Write onShow () and async if not
async onShow() { if ( typeof this.$root.$mp.page.getTabBar === "function" && this.$root.$mp.page.getTabBar() ) { This.$root.$mp.page. GetTabBar ().setData({activeIndex: 2 // index of the corresponding page}); } this.fnobjlist = wx.getStorageSync("userInfo"); Let openId = await getStorage(" openId "); let userInfo = await getStorage(openid); this.isLogin = wx.getStorageSync("userInfo").token && true; If (userInfo) {this.userInfo = userInfo; } else {// wx.getUserInfo let result = await getUserInfo(); this.userInfo = result.userInfo; // Use openId to cache the corresponding user information to local setStorage(this. openId, userInfo); }},Copy the code