PHP前端开发

微信小程序中json配置的配置方法介绍(附代码)

百变鹏仔 6天前 #前端问答
文章标签 代码

本篇文章给大家带来的内容是关于微信小程序中json配置的配置方法介绍(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

json配置可以分为:
1、app.json
2、page.json
一、app.json
app.json文件用来对微信小程序进行全局配置

{  **"pages"**: [    "pages/index/index",    "pages/logs/index"  ],  //调试快捷键:将鼠标点击到需要调试的页面,按住Alt同时按上键,这时,需要调试的页面就会一行一行的向上移动,直到首页  **"window"**: {    "navigationBarBackgroundColor":"#000000",//导航栏背景颜色    "navigationBarTextStyle":"black",//导航栏标题颜色,仅支持white和black    "navigationBarTitleText": "XXX",//导航栏标题文字内容    "backgroundColor":"#ffffff",//窗口的背景色    "backgroundTextStyle":"dark",//下拉 loading 的样式,仅支持 dark / light    "enablePullDownRefresh":true,//是否全局开启下拉刷新,true或false   "onReachBottomDistance":"50px";//页面上拉触底事件触发时距页面底部距离,单位为px。  },  **"tabBar"**: {      "color":"",//文字默认颜色      "selectedColor":"",//文字选中时的颜色      "backgroundColor":"",tab的背景色      "borderStyle":"",//tabbar上边框的颜色, 仅支持 black / white      "position":"",//tabBar的位置,仅支持 bottom / top    "list": [    //最少2个、最多5个 tab    {      "pagePath": "pages/index/index",      "text": "首页",      "iconPath":"XXXX",      "selectedIconPath":"XXX"    }, {      "pagePath": "pages/logs/logs",      "text": "日志"      "iconPath":"XXXX",      "selectedIconPath":"XXX"    }]  },  //其中 list 接受一个数组,只能配置最少2个、最多5个 tab。tab 按数组的顺序排序,每个项都是一个对象  **"networkTimeout"**: {    "request": 60000,//单位毫秒,默认60000    "uploadFile":60000,//单位毫秒,默认60000    "downloadFile": 60000//单位毫秒,默认60000  }}

二、page.json

{  "navigationBarBackgroundColor": "#ffffff",//导航栏背景颜色  "navigationBarTextStyle": "black",//导航栏标题颜色,仅支持 black / white  "navigationBarTitleText": "微信接口功能演示",//导航栏标题文字内容  "backgroundColor": "#eeeeee",//窗口的背景色  "backgroundTextStyle": "light",//下拉 loading 的样式,仅支持 dark / light  "enablePullDownRefresh":true,//是否全局开启下拉刷新  "onReachBottomDistance":"50px",//页面上拉触底事件触发时距页面底部距离,单位为px。  "disableScroll":false//设置为 true 则页面整体不能上下滚动;只在页面配置中有效,无法在 app.json 中设置该项}