tabBar如果小程序是一個多 tab 應用(客戶端窗口的底部或頂部有 tab 欄可以切換頁面),可以通過 tabBar 配置項指定 tab 欄的表現,以及 tab 切換時顯示的對應頁面。詳細屬性如下圖:
其中 list 接受一個數組,只能配置最少 2 個、最多 5 個 tab。tab 按數組的順序排序,每個項都是一個對象,其屬性值如下圖:
例如:
"tabBar": {
"backgroundColor": "#ffffff",
"selectedColor": "#FF0000",
"color": "#000000",
"position":"bottom",
"list":[
{
"pagePath":"pages/index/index",
"text":"首頁",
"iconPath":"images/ico2.png",
"selectedIconPath":"images/ico2.png"
},
{
"pagePath": "pages/logs/logs",
"text": "日誌",
"iconPath": "images/ico5.png",
"selectedIconPath": "images/ico5.png"
}
]
}