實現靜態的小程序Demo
1 { 2 "pages":[ 3 "pages/index/index", 4 "pages/join/join", 5 "pages/logs/logs" 6 ], 7 "window":{ 8 "backgroundTextStyle":"light", 9 "navigationBarBackgroundColor": "#0f0", 10 "navigationBarTitleText": "這是第一個測試小程序Demo", 11 "navigationBarTextStyle":"black" 12 }, 13 "tabBar": { 14 "selectedColor": "#00f", 15 "list": [{ 16 "pagePath": "pages/index/index", 17 "text": "首頁", 18 "iconPath": "images/home.jpg", 19 "selectedIconPath": "images/home1.jpg" 20 }, 21 { 22 "pagePath": "pages/join/join", 23 "text": "加入", 24 "iconPath": "images/join_p.jpg", 25 "selectedIconPath": "images/join_n.jpg" 26 }] 27 } 28 }
代碼分析:
13行:
"tabBar":
tabBar
如果小程序是一個多 tab 應用(客戶端窗口的底部或頂部有 tab 欄可以切換頁面),可以通過 tabBar 配置項指定 tab 欄的表現,以及 tab 切換時顯示的對應頁面。
Tip:
- 當設置 position 為 top 時,將不會顯示 icon
- tabBar 中的 list 是一個數組,只能配置最少2個、最多5個 tab,tab 按數組的順序排序。
調試結果如下: