您现在的位置是:首页 >技术杂谈 >【微信小程序】tabBar全局配置网站首页技术杂谈
【微信小程序】tabBar全局配置
简介【微信小程序】tabBar全局配置
一、tabBar的组成成分
| 属性 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| color | HexColor | 是 | tab 上的文字默认颜色,仅支持十六进制颜色 | |
| selectedColor | HexColor | 是 | tab 上的文字选中时的颜色,仅支持十六进制颜色 | |
| backgroundColor | HexColor | 是 | tab 的背景色,仅支持十六进制颜色 | |
| borderStyle | string | 否 | black | tabbar 上边框的颜色, 仅支持 black / white |
| list | Array | 是 | tab 的列表,详见 list 属性说明,最少 2 个、最多 5 个 tab | |
| position | string | 否 | bottom | tabBar 的位置,仅支持 bottom / top |
二、list属性
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| pagePath | string | 是 | 页面路径,必须在 pages 中先定义 |
| text | string | 是 | tab 上按钮文字 |
| iconPath | string | 否 | 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 当 position 为 top 时,不显示 icon。 |
| selectedIconPath | string | 否 | 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 当 position 为 top 时,不显示 icon。 |
更多信息:全局配置 | 微信开放文档
三、示例
"tabBar": {
"selectedColor": "#f3514f",
"color": "#666",
"backgroundColor": "#efefef",
"borderStyle":"black",
"position":"bottom",
"list": [
{
"text": "首页",
"pagePath": "pages/index/index",
"iconPath": "/image/first_page.png",
"selectedIconPath": "/image/active_fp.png"
},
{
"text": "分类",
"pagePath": "pages/classify/classify",
"iconPath": "/image/classify.png",
"selectedIconPath": "/image/active_classify.png"
},
{
"text": "购物车",
"pagePath": "pages/car/car",
"iconPath": "/image/buy_car.png",
"selectedIconPath": "/image/active_car.png"
},
{
"text": "我的",
"pagePath": "pages/me/me",
"iconPath": "/image/me.png",
"selectedIconPath": "/image/active_me.png"
}
]
},

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结