app.json文件用来对微信小程序进行全局配置,决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。相关属性解释如下:
tabBar | 底部的 导航配置属性 |
---|---|
color | 未选择时 底部导航文字的颜色 |
selectedColor | 选择时 底部导航文字的颜色 |
borderStyle | 底部导航边框的样色 |
list | 导航配置数组 |
text | 导航图标下方文字 |
iconPath | 未选择时 图标路径 |
selectedIconPath | 选中时 图标路径 |
pagePath | 页面访问地址 |
borderStyle中如果没有写入样式 会导致 导航框上边框会出现默认的浅灰色线条,如下图所示:
相关代码如下所示:
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"selectedIconPath": "pages/img/下载.jpeg",
"iconPath": "pages/img/下载.jpeg"
},
{
"pagePath": "pages/snack/snack",
"text": "贪吃蛇",
"selectedIconPath": "pages/img/timg.jpeg",
"iconPath": "pages/img/timg.jpeg"
}
]
}
更详细的设置请参考官方文档:https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#tabBar