tt.setTabBarItem
基础库 1.44.0 开始支持,低版本需做兼容处理。
效果: 动态设置 Tab
参数
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| index | number | 是 | 左起第一个为 0 |
| text | string | 否 | Tab 上的文字 |
| iconPath | string | 否 | 图片路径 |
| selectedIconPath | string | 否 | 选中时的图片路径 |
| success | function | 否 | 接口调用成功的回调函数 |
| fail | function | 否 | 接口调用失败的回调函数 |
| complete | function | 否 | 接口调用结束的回调函数 |
示例代码
tt.setTabBarItem({
index: 0,
text: "text",
iconPath: "/path/to/iconPath",
selectedIconPath: "/path/to/selectedIconPath"
});