微信小程序tabbar通俗點說就是底部導航,我們一般會配置相關的菜單,方便讀者快速導航。tabbar是在項目根目錄中的配置文件 app.json 中進行設置;如果小程序是一個多 tab 應用(客戶端窗口的底部或頂部有 tab 欄可以切換頁面),可以通過 tabBar 配置項指定 tab 欄的表現,以及 tab 切換時顯示的對應頁面。tips:當設置 position 為 top 時,將不會顯示 icon; tabBar 中的 list 是一個數組,只能配置最少2個、最多5個 tab,tab 按數組的順序排序。

"tabBar": {
"color": "#a9b7b7",
"selectedColor": "#11cd6e",
"borderStyle":"black",
"backgroundColor": "#ffffff",
"list": [{
"selectedIconPath": "images/111.png",
"iconPath": "images/11.png",
"pagePath": "pages/index/index",
"text": "首頁"
}, {
"selectedIconPath": "images/221.png",
"iconPath": "images/22.png",
"pagePath": "pages/logs/logs",
"text": "日志"
}]
}
tabBar 指底部的 導航配置屬性
color 未選擇時 底部導航文字的顏色
selectedColor 選擇時 底部導航文字的顏色
borderStyle 底部導航邊框的顏色(注意:tabbar上邊框的顏色, 僅支持 black/white,默認值是black)
list 導航配置數組
selectedIconPath 選中時 圖標路徑
iconPath 未選中時 圖標路徑
pagePath 頁面訪問地址
text 導航圖標下方文字
