PHP前端开发

小程序项目基本配置

百变鹏仔 1个月前 (03-12) #前端问答
文章标签 基本配置

小程序中的配置文件分为两种:

全局配置文件,根目录下的app.json

页面配置文件,每个页面目录下的[page-name].json

app.json

项目配置声明文件(指定项目的一些信息,比如导航栏样式颜色等等)

{  // 当前程序是由哪些页面组成的(第一项默认为初始页面)  // 所有使用到的组件或页面都必须在此体现// 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的设置:

{  // 导航条背景色  "navigationBarBackgroundColor": "#35495e",  // 导航条前景色(只能是white/black)  "navigationBarTextStyle": "white",  // 导航条文本  "navigationBarTitleText": "电影 « 豆瓣",  // 窗口背景颜色  "backgroundColor": "#fff",  // 窗口前景色  "backgroundTextStyle": "dark",  // 是否开启下拉刷新  "enablePullDownRefresh": true}