title: Taro.setTabBarStyle(option)

sidebar_label: setTabBarStyle

动态设置 tabBar 的整体样式

支持情况:setTabBarStyle - 图1 setTabBarStyle - 图2 setTabBarStyle - 图3

参考文档

类型

  1. (option?: Option) => Promise<TaroGeneral.CallbackResult>

参数

参数 类型
option Option

Option

参数 类型 必填 说明
backgroundColor string tab 的背景色,HexColor
borderStyle string tabBar上边框的颜色, 仅支持 black/white
color string tab 上的文字默认颜色,HexColor
complete (res: TaroGeneral.CallbackResult) => void 接口调用结束的回调函数(调用成功、失败都会执行)
fail (res: TaroGeneral.CallbackResult) => void 接口调用失败的回调函数
selectedColor string tab 上的文字选中时的颜色,HexColor
success (res: TaroGeneral.CallbackResult) => void 接口调用成功的回调函数

示例代码

  1. Taro.setTabBarStyle({
  2. color: '#FF0000',
  3. selectedColor: '#00FF00',
  4. backgroundColor: '#0000FF',
  5. borderStyle: 'white'
  6. })