uni.showTabBar(options?)
显示 tabBar
showTabBar 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | ShowTabBarOptions | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | animation | boolean | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 是否需要动画效果 | | success | (result: ShowTabBarSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: ShowTabBarFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: ShowTabBarComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
ShowTabBarSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
ShowTabBarFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
ShowTabBarComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<ShowTabBarSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.hideTabBar(options?)
隐藏 tabBar
hideTabBar 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | HideTabBarOptions | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | animation | boolean | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 是否需要动画效果 | | success | (result: HideTabBarSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: HideTabBarFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: HideTabBarComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
HideTabBarSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
HideTabBarFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
HideTabBarComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<HideTabBarSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.showTabBarRedDot(options)
显示 tabBar 某一项的右上角的红点
showTabBarRedDot 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | ShowTabBarRedDotOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | index | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tabBar的哪一项,从左边算起,索引从0开始 | | success | (result: ShowTabBarRedDotSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: ShowTabBarRedDotFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: ShowTabBarRedDotComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
ShowTabBarRedDotSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
ShowTabBarRedDotFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
ShowTabBarRedDotComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<ShowTabBarRedDotSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.hideTabBarRedDot(options)
隐藏 tabBar 某一项的右上角的红点
hideTabBarRedDot 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | HideTabBarRedDotOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | index | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tabBar的哪一项,从左边算起,索引从0开始 | | success | (result: HideTabBarRedDotSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: HideTabBarRedDotFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: HideTabBarRedDotComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
HideTabBarRedDotSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
HideTabBarRedDotFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
HideTabBarRedDotComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<HideTabBarRedDotSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.setTabBarBadge(options)
为 tabBar 某一项的右上角添加文本
setTabBarBadge 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | SetTabBarBadgeOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | index | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tabBar的哪一项,从左边算起,索引从0开始 | | text | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 显示的文本,不超过 3 个半角字符 | | success | (result: SetTabBarBadgeSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: SetTabBarBadgeFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: SetTabBarBadgeComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
SetTabBarBadgeSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
SetTabBarBadgeFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
SetTabBarBadgeComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<SetTabBarBadgeSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.removeTabBarBadge(options)
移除 tabBar 某一项右上角的文本
removeTabBarBadge 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | RemoveTabBarBadgeOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | index | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tabBar的哪一项,从左边算起,索引从0开始 | | success | (result: RemoveTabBarBadgeSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: RemoveTabBarBadgeFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: RemoveTabBarBadgeComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
RemoveTabBarBadgeSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
RemoveTabBarBadgeFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
RemoveTabBarBadgeComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<RemoveTabBarBadgeSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
uni.setTabBarStyle(options)
动态设置 tabBar 的整体样式
setTabBarStyle 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | x |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | SetTabBarStyleOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | color | string (string.ColorString) | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| tab 上的文字默认颜色 | | selectedColor | string (string.ColorString) | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| tab 上的文字选中时的颜色 | | backgroundColor | string (string.ColorString) | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| tab 的背景色 | | backgroundImage | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| 图片背景 | | backgroundRepeat | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| 背景图平铺方式 | | 合法值 | 兼容性 | 描述 | | repeat | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 背景图片在垂直方向和水平方向平铺 | | repeat-x | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 背景图片在水平方向平铺,垂直方向拉伸 | | repeat-y | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 背景图片在垂直方向平铺,水平方向拉伸 | | no-repeat | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 背景图片在垂直方向和水平方向都拉伸 |
| | borderColor | string (string.ColorString) | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | 4.23 | 4.41 | x | 4.23 | x |
| tabbar上边框的颜色(优先级高于 borderStyle) | | borderStyle | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| tabbar上边框的颜色 | | 合法值 | 兼容性 | 描述 | | black | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| - | | white | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| - |
| | success | (result: SetTabBarStyleSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| 接口调用成功的回调函数 | | fail | (result: SetTabBarStyleFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| 接口调用失败的回调函数 | | complete | (result: SetTabBarStyleComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | x |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
SetTabBarStyleSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| |
SetTabBarStyleFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| |
SetTabBarStyleComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| |
返回值
| 类型 | 必备 |
| Promise<SetTabBarStyleSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | x |
| |
|
参见
uni.setTabBarItem(options)
动态设置 tabBar 某一项的内容
setTabBarItem 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS |
| 4.0 | 4.41 | 3.91 | 4.11 | 4.61 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | SetTabBarItemOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | index | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tabBar 的哪一项,从左边算起,索引从0开始 | | text | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tab 上按钮文字 | | iconPath | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 图片路径 | | selectedIconPath | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 选中时的图片路径 | | pagePath | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | √ | x | x | x | x |
| 页面绝对路径 | | iconfont | SetTabBarItemIconFontOptions | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 字体图标,优先级高于 iconPath | | 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | text | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 字库 Unicode 码 | | selectedText | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 选中后字库 Unicode 码 | | fontSize | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 字体图标字号(px) | | color | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 字体图标颜色 | | selectedColor | string | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 字体图标选中颜色 |
| | visible | boolean | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| tab 是否显示 | | success | (result: SetTabBarItemSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用成功的回调函数 | | fail | (result: SetTabBarItemFail) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用失败的回调函数 | | complete | (result: SetTabBarItemComplete) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
SetTabBarItemSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
SetTabBarItemFail 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errCode | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误码 |
| 合法值 | 兼容性 | 描述 | | 100 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| TabBar 不存在 | | 200 | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 参数错误 |
|
| errSubject | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 统一错误主题(模块)名称 |
| data | any | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 错误信息中包含的数据 |
| cause | Error | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| 源错误信息,可以包含多个错误,详见SourceError |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
SetTabBarItemComplete 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
返回值
| 类型 | 必备 |
| Promise<SetTabBarItemSuccess> | 否 |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
|
参见
注意:小程序上无法通过本API动态添加和删除tabbar的item。
通用类型
GeneralCallbackResult
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 错误信息 |
Bug & Tips
- 自 4.23 起,在非 tabbar 页面调用以上 API 会报错:hideTabBar:fail not TabBar page
- uni-app-x harmony 暂不支持隐藏TabBarItem