#### 项目配置 <p align="center"> ![小程序界面结构](./img/config.jpg) </p> > 相关链接: > - [官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html) > - [生成配置文件](https://weapptool.com/start.html) 小程序中的配置文件分为两种: - 全局配置文件,根目录下的app.json - 页面配置文件,每个页面目录下的[page-name].json ### app.json 项目配置声明文件(指定项目的一些信息,比如导航栏样式颜色等等) ```javascript { // 当前程序是由哪些页面组成的(第一项默认为初始页面) // 所有使用到的组件或页面都必须在此体现 // https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#pages "pages": [ ... ], // 应用程序窗口设置 // https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#window "window": { ... }, // 应用导航栏设置 // https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#tabBar "tabBar": { ... }, // 网络超时设置 // https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#networkTimeout "networkTimeout": {}, // 是否在控制台输出调试信息 // https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html#debug "debug": true } ``` ### [page-name].json 用于指定特定页面工作时,window的设置: ```javascript { // 导航条背景色 "navigationBarBackgroundColor": "#35495e", // 导航条前景色(只能是white/black) "navigationBarTextStyle": "white", // 导航条文本 "navigationBarTitleText": "电影 « 豆瓣", // 窗口背景颜色 "backgroundColor": "#fff", // 窗口前景色 "backgroundTextStyle": "dark", // 是否开启下拉刷新 "enablePullDownRefresh": true } ```