小程序根目录下的 app.json 文件用来对微信小程序进行全局配置,决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。官方文档
{
"pages": [//页面路径列表
"pages/index/index",//设置页面路径
"pages/logs/logs"
],
"window": {//全局的默认窗口表现
"backgroundTextStyle": "light",//下拉 loading 的样式,仅支持 dark / light
"navigationBarBackgroundColor": "#fff",//导航栏背景颜色
"navigationBarTitleText": "WeChat",//导航栏标题文字内容
"navigationBarTextStyle": "black"//导航栏标题颜色,仅支持 black / white
},
"tabBar": {//底部 tab 栏的表现
"color": "#a9b7b7",//tab 上的文字默认颜色,仅支持十六进制颜色
"selectedColor": "#eb4f38",//tab 上的文字选中时的颜色,仅支持十六进制颜色
"backgroundColor": "#ffffff",//tab 的背景色,仅支持十六进制颜色
"borderStyle": "black",//tabbar 上边框的颜色, 仅支持 black / white
"list": [//tab 的列表,最少 2 个、最多 5 个 tab
{
"pagePath": "pages/index/index",//页面路径,必须在 pages 中先定义
"text": "首页",//tab 上按钮文字
"iconPath": "images/index.png",//图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。
"selectedIconPath": "images/index_select.png"//选中时的图片路径
},
{
"pagePath": "pages/logs/index",
"text": "日志",
"iconPath": "images/logs.png",
"selectedIconPath": "images/logs_select.png"
}
]
},
"networkTimeout": {//网络超时时间,单位均为毫秒。
"request": 10000,//wx.request的超时时间,单位:毫秒,默认:60000。
"connectSocket": 10000,//wx.connectSocket的超时时间,单位:毫秒,默认:60000。
"uploadFile": 10000,//wx.uploadFile的超时时间,单位:毫秒,默认:60000。
"downloadFile": 10000//wx.downloadFile的超时时间,单位:毫秒,默认:60000。
},
"navigateToMiniProgramAppIdList": [//声明需要跳转的小程序 appId 列表,最多允许填写 10 个。
"小程序appid",
"小程序appid"
],
"debug": true,//是否开启 debug 模式,默认关闭
"style": "v2",//app.json 中配置 "style": "v2"可表明启用新版的组件样式。
"sitemapLocation": "sitemap.json",//指明 sitemap.json 的位置
//sitemap.json 文件用于配置小程序及其页面是否允许被微信索引
}
网友评论