微信小程序tabBar底部导航中文注解api,信小程序tabBar就是app底部的那个导航栏,可以放1-5导航链接,这里对微信小程序底部导航tabbar的中文解释。
微信小程序tabBar是在全局app.json文件里面配置的。
小程序tabBar配置代码注解
{
"pages":[
"pages/index/index",
"pages/detail/detail"
],
"window":{
"navigationBarTitleText": "TabBar",
"navigationBarBackgroundColor": "#F60",
"navigationBarTextStyle": "white"
},
"tabBar":{
"color": "#ddd",
"selectedColor": "#3cc51f",
"backgroundColor": "#fff",
"borderStyle":"black",
"list":[{
"pagePath":"pages/index/index",
"iconPath":"image/icon_API.png",
"selectedIconPath":"image/icon_API_HL.png",
"text":"index"
},{
"pagePath":"pages/detail/detail",
"iconPath":"image/icon_component.png",
"selectedIconPath":"image/icon_component_HL.png",
"text":"detail"
}]
}
}
小程序tabBar参数说明
如果我们的小程序是一个多 tab 应用(客户端窗口的底部有tab栏可以切换页面),那么我们可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。
tabBar 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。
属性说明:
属性 |
类型 |
必填 |
默认值 |
描述 |
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 |
可选值 bottom、top |
其中 list 接受一个数组,数组中的每个项都是一个对象,其属性值如下:
属性 |
类型 |
必填 |
说明 |
pagePath |
String |
是 |
页面路径,必须在 pages 中先定义 |
text |
String |
是 |
tab 上按钮文字 |
iconPath |
String |
是 |
图片路径,icon 大小限制为40kb |
selectedIconPath |
String |
是 |
选中时的图片路径,icon 大小限制为40kb |
