1. 設置底部菜單主要是利用"tabBar"。
我們去開發文檔看一下對應的內容:
2. 實際代碼編寫
"tabBar": {
"selectedColor": "#00BFFF",
"backgroundColor": "#F8F8FF",
"borderStyle": "white",//設置顏色,下面就是設置顯示內容
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/報寢.png",
"selectedIconPath": "images/報寢.png",
"text": "報寢"
},
{
"pagePath": "pages/fun/fun",
"iconPath": "images/功能.png",
"selectedIconPath": "images/功能.png",
"text": "功能"
},
{
"pagePath": "pages/my/my",
"iconPath": "images/我的.png",
"selectedIconPath": "images/我的.png",
"text": "我的"
}
]
},
運行結果:
3. 注意一下,selectedIconPath對於圖片的大小有限制的,如果超過40kb會報錯的。