程序开发之api背景界面参数(附代码示例

网友投稿 159 2024-07-09

背景

#setBackgroundTextStyle

基础库1.3.9开始支持,iOS版本2.1.23,Android版本2.1.38

小程序开发之api背景界面参数(附代码示例)

ft.setBackgroundTextStyle(Object object)

动态设置下拉背景字体、loading 图的样式

参数

Object object

属性类型默认值必填说明
textStylestring
下拉背景字体、loading 图的样式。
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

object.textStyle 的合法值

说明
darkdark 样式
lightlight 样式

示例代码

ft.setBackgroundTextStyle({
  textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark})
        已复制代码

#setBackgroundColor

基础库1.3.9开始支持,iOS版本2.1.23,Android版本2.1.38

ft.setBackgroundColor(Object object)

动态设置窗口的背景色

参数

Object object

属性类型默认值必填说明
backgroundColorstring
窗口的背景色,必须为十六进制颜色值
backgroundColorTopstring
顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持
backgroundColorBottomstring
底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

示例代码

ft.setBackgroundColor({
  backgroundColor: '#ffffff', // 窗口的背景色为白色})ft.setBackgroundColor({
  backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
  backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色})
        已复制代码

#Tab Bar

#showTabBarRedDot

ft.showTabBarRedDot(Object object)

显示 tabBar 某一项的右上角的红点

参数

Object object

属性类型默认值必填说明
indexnumber
tabBar 的哪一项,从左边算起
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

#showTabBar

ft.showTabBar(Object object)

显示 tabBar

参数

Object object

属性类型默认值必填说明
animationbooleanfalse是否需要动画效果
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

#setTabBarStyle

ft.setTabBarStyle(Object object)

动态设置 tabBar 的整体样式

参数

Object object

属性类型默认值必填说明
colorstring
tab 上的文字默认颜色,HexColor
selectedColorstring
tab 上的文字选中时的颜色,HexColor
backgroundColorstring
tab 的背景色,HexColor
borderStylestring
tabBar上边框的颜色, 仅支持 black/white
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

示例代码

ft.setTabBarStyle({
  color: '#FF0000',
  selectedColor: '#00FF00',
  backgroundColor: '#0000FF',
  borderStyle: 'white'})
        已复制代码

#setTabBarItem

ft.setTabBarItem(Object object)

动态设置 tabBar 某一项的内容,2.7.0 起图片支持临时文件和网络文件。

参数

Object object

属性类型默认值必填说明
indexnumber
tabBar 的哪一项,从左边算起
textstring
tab 上的按钮文字
iconPathstring
图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效
selectedIconPathstring
选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

示例代码

ft.setTabBarItem({
  index: 0,
  text: 'text',
  iconPath: '/path/to/iconPath',
  selectedIconPath: '/path/to/selectedIconPath'})
        已复制代码

#setTabBarBadge

基础库1.3.9开始支持,iOS版本2.1.23,Android版本2.1.38

为 tabBar 某一项的右上角添加文本

属性类型默认值必填说明
indexnumber
tabBar 的哪一项,从左边算起
textstring
显示的文本,超过 4 个字符则显示成 ...
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

示例代码

ft.setTabBarBadge({
  index: 0,
  text: '1'})
        已复制代码

#removeTabBarBadge

基础库1.3.9开始支持,iOS版本2.1.23,Android版本2.1.38

移除 tabBar 某一项右上角的文本

属性类型默认值必填说明
indexnumber
tabBar 的哪一项,从左边算起
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

#hideTabBarRedDot

ft.hideTabBarRedDot(Object object)

隐藏 tabBar 某一项的右上角的红点

参数

Object object

属性类型默认值必填说明
indexnumber
tabBar 的哪一项,从左边算起
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)

#hideTabBar

ft.hideTabBar(Object object)

隐藏 tabBar

参数

Object object

属性类型默认值必填说明
animationbooleanfalse是否需要动画效果
successfunction
接口调用成功的回调函数
failfunction
接口调用失败的回调函数
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:小程序开发之API界面导航栏参数说明
下一篇:小程序开发之字体参数说明(附代码示例)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~