小程序
小游戏
企业微信
微信支付
扫描小程序码分享
怎么解决
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
在App.vue 中添加
globalData: {
tabindex: 0, // tabbar对应下标
},
在custom-tab-bar index.js 中添加 attached 并在switchTab 方法中修改 globalData.tabindex
代码如下:
lifetimes: { attached: function () { if (typeof app.globalData.tabindex !== 'undefined' && this.data.selected !== app.globalData.tabindex) { console.log('tabindex changed:', app.globalData.tabindex) this.setData({ selected: app.globalData.tabindex }) } } }, methods: { switchTab(e) { const { index, path } = e.currentTarget.dataset const url = path wx.switchTab({ url: `/${url}` }) app.globalData = { tabindex: index } } }
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
用uView的底部导航栏组件,https://v1.uviewui.com/components/tabbar.html
老问题,暂时没有解决方案
试下wx.setNavigationBarTitle更新标题,不写在json里面
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
在App.vue 中添加
globalData: {
tabindex: 0, // tabbar对应下标
},
在custom-tab-bar index.js 中添加 attached 并在switchTab 方法中修改 globalData.tabindex
代码如下:
lifetimes: { attached: function () { if (typeof app.globalData.tabindex !== 'undefined' && this.data.selected !== app.globalData.tabindex) { console.log('tabindex changed:', app.globalData.tabindex) this.setData({ selected: app.globalData.tabindex }) } } }, methods: { switchTab(e) { const { index, path } = e.currentTarget.dataset const url = path wx.switchTab({ url: `/${url}` }) app.globalData = { tabindex: index } } }用uView的底部导航栏组件,https://v1.uviewui.com/components/tabbar.html
老问题,暂时没有解决方案
试下wx.setNavigationBarTitle更新标题,不写在json里面