在根目录的app.json中添加tabBar,示例如下
{
"pages": [
"pages/index/index",
"pages/logs/logs",
"pages/scanning/scanning"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#a9b7b7",
"selectedColor": "#11cd6e",
"borderStyle": "white",
"list": [
{
"selectedIconPath": "images/11.png",
"iconPath": "images/11.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"selectedIconPath": "images/11.png",
"iconPath": "images/11.png",
"pagePath": "pages/logs/logs",
"text": "日志"
}
]
}
}
注:在小程序中,最后一个括号后面不能带',',否则会出现编译错误