【2025年1月2日】关于腾讯云小程序平台更名为腾讯云超级应用服务的公告
控制台更新动态
Android SDK 更新动态
iOS SDK 更新动态
Flutter 更新动态
IDE 更新动态
基础库更新动态
getTabBar 接口获取组件实例,并调用 setData 更新选中态。可参考底部的代码示例。app.json 中的 tabBar 项指定 custom 字段,同时其余 tabBar 相关配置也补充完整;usingComponents 项,也可以在 app.json 全局开启。{"tabBar": {"custom": true,"color": "#000000","selectedColor": "#000000","backgroundColor": "#000000","list": [{"pagePath": "page/component/index","text": "组件"}, {"pagePath": "page/API/index","text": "接口"}]},"usingComponents": {}}
custom-tab-bar/index.jscustom-tab-bar/index.jsoncustom-tab-bar/index.wxmlcustom-tab-bar/index.wxss
getTabBar 接口,可获取当前页面下的自定义 tabBar 组件实例。Component({pageLifetimes: {show() {if (typeof this.getTabBar === 'function' &&this.getTabBar()) {this.getTabBar().setData({selected: 0})}}}})
文档反馈