【app.json】配置说明,不断更新中

app.json文件用来对微信小程序进行全局配置,决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。json

 

注意:小程序

1) json配置中键名、键值必须使用双引号,不能使用单引号。微信小程序

2) 如下配置中除了page字段是必需设置,其它项目为可选项。数组

 

置项说明:微信

 1 {  2 
 3   /**  4  * 【必需】 pages 键值是一列数组  5  * 指定小程序由哪些页面组成,每一项都对应一个页面的 路径+文件名 信息。文件名不须要写文件后缀  6  * 数组第一项表明小程序的首页  7  **/
 8   "pages": [  9     "pages/index/index",  10     "pages/logs/index"
 11  ],  12 
 13   
 14   /**  15  * window 用于设置小程序的状态栏、导航条、标题、窗口背景色。  16  **/
 17   "window": {  18       
 19     /**  20  * 如下是页面顶部导航栏设置  21  **/
 22     "navigationBarBackgroundColor" : "[Color]", // 导航栏背景颜色,默认值:#000000
 23     "navigationBarTextStyle" : "white|black", // 导航栏标题颜色,默认值white
 24     "navigationBarTitleText": "[String]" , // 导航栏标题文字内容
 25     "navigationStyle" : "default|custom", // 导航样式,默认值default。 custom 自定义导航栏,只保留右上角胶囊按钮
 26     
 27     /**  28  * 如下是下拉刷新或上拉触底设置  29  **/
 30     "backgroundColor" : "[Color]", // 窗口的背景色
 31     "backgroundTextStyle" : "dark|light", // 下拉 loading 的样式,默认值dark(暗)
 32     "backgroundColorTop" : "[Color]", // 顶部窗口的背景色,仅 iOS 支持
 33     "backgroundColorBottom" : "[Color]", // 底部窗口的背景色,仅 iOS 支持 
 34     "enablePullDownRefresh" : true|false, // 是否全局开启下拉刷新,值 true | false
 35     "onReachBottomDistance" : [Number] // 页面上拉触底事件触发时距页面底部距离,单位为px,默认值 50
 36     
 37  },  38   
 39 
 40   /**  41  * tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。  42  **/
 43   "tabBar": {  44     
 45     "color" : "[Color]", // 【必需】 tab 上的文字默认颜色
 46     "selectedColor" : "[Color]", // 【必需】 tab 上的文字选中时的颜色
 47     "backgroundColor" : "[Color]", // 【必需】 tab 的背景色
 48     "borderStyle" : "black|white", // tabbar上边框的颜色, 默认值:black
 49     "position" : "bottom|top", // tabBar的位置,仅支持 bottom / top
 50     
 51     /**  52  * 【必需】 tab 的列表,最少2个、最多5个 tab  53  **/
 54     "list": [  55  {  56         "pagePath": "[String]", // 【必需】 打开的页面路径,必须在 pages 中先定义
 57         "text": "[String]", // 【必需】 tab 上按钮文字,好比首页
 58         "iconPath" : "[String]", // 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。 当 postion 为 top 时,不显示 icon。
 59         "selectedIconPath" : "[String]" // 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。当 postion 为 top 时,不显示 icon。
 60  },  61  {  62         "pagePath": "[String]",  63         "text": "[String]",  64         "iconPath" : "[String]",  65         "selectedIconPath" : "[String]" 
 66  }  67       //设置每一个列表...
 68  ]  69  },  70   
 71   
 72   /**  73  * networkTimeout 各种网络请求的超时时间,单位均为毫秒。  74  **/
 75   "networkTimeout": {  76     "request" : [Number],  // wx.request 的超时时间。默认值 60000
 77     "connectSocket" : [Number], // wx.connectSocket 的超时时间。默认值 60000 
 78     "uploadFile" : [Number], // wx.uploadFile 的超时时间。默认值 60000
 79     "downloadFile": [Number] // wx.downloadFile 的超时时间。默认值 60000
 80  },  81   
 82   
 83   /**  84  * debug 是否开启调试模式,默认关闭(false)  85  **/
 86   "debug": true|false,  87 
 88   "resizable": true|false, // 值true时使小程序支持 iPad 屏幕旋转 
 89   /**  90  * functionalPages 是否启用插件功能页,默认关闭(false)  91  **/
 92   "functionalPages" : true|false,  93   
 94 
 95   /**  96  * usingComponents 定义全局能够使用的自定义组件(全部页面可用)  97  **/
 98   "usingComponents": {  99       "component-tag-name": "component-path", // 格式:组件标签名称 : 自定义组件路径
100       // 可定义多个自定义组件
101  } 102   
103   /** 104  * subPackages 105  **/
106   
107   
108   /** 109  * workers 110  **/
111   
112   
113   /** 114  * requiredBackgroundModes 115  **/
116   
117   
118   /** 119  * plugins 120  **/
121   
122 }
相关文章
相关标签/搜索