The small root directory app.json
file used to program the micro channel small global configuration, the path decision page file, the performance of the window, the network timeout is provided, a plurality tab like.
The following is a section containing common configuration options app.json
{
"pages": [
"pages/index/index",
"pages/logs/index"
],
"window": {
"navigationBarTitleText": "Demo"
},
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "首页"
}, {
"pagePath": "pages/logs/index",
"text": "日志"
}]
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"debug": true,
"navigateToMiniProgramAppIdList": [
"wxe5f52902cf4de896"
]
}
Please refer to the complete configuration Item Description
[https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html]
The small root directory app.jso
file used to program the micro channel small global configuration. The contents of a file as JSON
an object, has the following attributes:
Configuration Item
Attributes | Types of | Mandatory | description | Minimum version |
---|---|---|---|---|
pages | string[] | Yes | Page path list | |
window | Object | no | Global default window performance | |
tabs | Object | no | The bottom tab bar of performance |
|
networkTimeout | Object | no | Network timeout | |
debug | boolean | no | Debug mode is turned off by default | |
functional pages | boolean | no | Whether to enable plug-page feature, disabled by default | 2.1.0 |
subpackages | Object[] | no | Sub-structure configuration | 1.7.3 |
workers | string | no | Worker Code is placed in the directory |
1.9.90 |
requiredBackgroundModes | string[] | no | You need the ability to use the background, such as "music" | |
plugins | Object | no | To use plug-ins | 1.9.6 |
preloadRule | Object | no | Subcontracting pre-download rules | 2.3.0 |
resizable | boolean | no | iPad applet supports screen rotation, off by default | 2.3.0 |
navigateToMiniProgramAppIdList | string[] | no | Jump need a list of applets, see wx.navigateToMiniProgram | 2.4.0 |
usingComponents | Object | no | Global custom component configuration | Developer Tools 1.02.1810190 |
permission | Object | no | Small program interface permission settings | 7.0.0 Client WeChat |
sitemap location | string | Yes | Sitemap.json specified location | |
style | string | no | After the upgrade weui specify style | 2.8.0 |
useExtendedLib | Object | no | Specified extensions need to reference | 2.2.1 |
entranceDeclare | Object | no | With micro-channel message opened applet | WeChat client 7.0.9 |
pages
for specifying which pages consisting of applets, each of which corresponds to a page of the path (including file name) information. File names do not have to write the file extension, the framework will automatically go looking for the location. json
,. js
,. wxml
,. wxss
Four files for processing.
An array of first term represents the applet initial page (home page). Applet add / reduce page, you need to modify the pages array.
Such as the development directory:
├── app.js
├── app.json
├── app.wxss
├── pages
│ │── index
│ │ ├── index.wxml
│ │ ├── index.js
│ │ ├── index.json
│ │ └── index.wxss
│ └── logs
│ ├── logs.wxml
│ └── logs.js
└── utils
You need to app.json
write in
{
"pages": ["pages/index/index", "pages/logs/logs"]
}
status bar to set the applet, navigation bar, title, window background color.
Attributes | Types of | Defaults | description | Minimum version |
---|---|---|---|---|
navigationBarBackgroundColor | HexColor | #000000 | Navigation bar background color, such as #000000 |
|
navigationBarTextStyle | string | white | Navigation Bar title color, only supports black /white |
|
navigationBarTitleText | string | Navigation bar title text | ||
navigationStyle | string | default | Navigation bar style, only supports the following values: default default style custom custom navigation bar, leaving only the upper right corner of capsules button. See note 2. |
6.6.0 Client WeChat |
backgroundColor | HexColor | #ffffff | Background color of the window | |
backgroundTextStyle | string | dark | Loading the pull-down style, only supports dark /light |
|
backgroundColorTop | string | #ffffff | The background color of the top of the window, only iOS support | WeChat client 6.5.16 |
backgroundColorBottom | string | #ffffff | The background color of the bottom of the window, only iOS support | WeChat client 6.5.16 |
enablePullDownRefresh | boolean | false | Whether to open the global pull-down refresh. See Page.onPullDownRefresh |
|
onReachBottomDistance | number | 50 | Distance from the bottom of the page, the unit is bottoming px pull the trigger on the event page. See Page.onReachBottom |
|
pageOrientation | string | portrait | Set screen rotation support auto / portrait / landscape See the display area in response to changes in |
2.4.0 (auto) / 2.5.0 (landscape) |
Note 2: About navigationStyle
client version 7.0.0 the end, navigationStyle only take effect in app.json.
The client version 6.7.2 start, navigationStyle: custom components for web-view invalid
compatible after opening custom, low version of the client needs to do. Developer Tools to cut basic library version 1.7.0 (minimum version does not mean, only for debugging) can be easily cut to the old vision such as:
{
"window": {
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "微信接口功能演示",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
}
}
If the applet is a multi-application tab (bottom or top of the client window has tab bar to switch the page), the performance of the specified item bar tab, and the tab corresponding to the page for the handover can be configured via tabBar.
Attributes | Types of | Mandatory | Defaults | description | Minimum version |
---|---|---|---|---|---|
color | HexColor | Yes | The default color for text on the tab, only supports hexadecimal color | ||
selectedColor | HexColor | Yes | When the color of the selected text on the tab, only supports hexadecimal color | ||
backgroundColor | HexColor | Yes | tab background color, only supports hexadecimal color | ||
borderStyle | string | no | black | color of the border on the tabbar, only supports black /white |
|
list | Array | Yes | tab lists, detailed list properties described, at least two, up to five tab |
||
position | string | no | bottom | tabBar position, the only support bottom /top |
|
custom | boolean | no | false | Custom tabBar, see details | 2.5.0 |
Attributes | Types of | Mandatory | Explanation |
---|---|---|---|
pagePath | string | Yes | Page path must be defined in the pages of |
text | string | Yes | The tab button text |
iconPath | string | no | Pictures path, icon size limit of 40kb, recommended size is 81px * 81px, does not support network picture. When position it is top not displayed icon. |
selectedIconPath | string | no | Pictures path when selected, icon size limit of 40kb, recommended size is 81px * 81px, does not support network picture. When position it is top not displayed icon. |
timeout various types of network requests, units are in milliseconds.
Attributes | Types of | Mandatory | Defaults | Explanation |
---|---|---|---|---|
request | number | no | 60000 | wx.request timeout, unit: ms. |
connectSocket | number | no | 60000 | wx.connectSocket timeout, unit: ms. |
uploadFile | number | no | 60000 | wx.uploadFile timeout, unit: ms. |
downloadFile | number | no | 60000 | wx.downloadFile timeout, unit: ms. |
can be opened in developer tools in debug mode, the console panel in developer tools, debugging information given in the form info, the registration information has Page, page routing, data updates, event triggers and so on. It can help developers quickly locate some common issues.
functionalPages
Infrastructure Library 2.1.0 support, low version is compatible with processing to be done.
Plug the owner of a small program you need to set this function to enable plug-ins page.
subpackages
micro-channel client 6.6.0, 1.7.3 and above basic library support
When enabled sub-loaded, declared project subcontracting structure.
Written subPackages also supported.
workers
Infrastructure Library 1.9.90 began to support low-compatible version to be done to deal with.
When you use Worker handle multi-threaded tasks, set Worker code is placed in the directory
requiredBackgroundModes
micro-channel client 6.7.2 and above support
Affirming the need the ability to run in the background, the type of array. Currently supports the following projects:
audio: Background music
location: Positioning the background
, such as:
{
"pages": ["pages/index/index"],
"requiredBackgroundModes": ["audio", "location"]
}
plugins
Infrastructure Library 1.9.6 started to support low version is compatible with processing to be done.
Statement applet requires the use of plug-ins.
preloadRule
Infrastructure Library 2.3.0 started to support low version is compatible with processing to be done.
Statement subcontracting rules pre-downloaded.
resizable
Infrastructure Library 2.3.0 started to support low version is compatible with processing to be done.
Small programs that run on the iPad you can set the screen rotation support.
navigateToMiniProgramAppIdList
Infrastructure Library 2.4.0 started to support low version is compatible with processing to be done.
When the applet need to use wx.navigateToMiniProgram interfaces jump to another small program, you need to declare the need to jump in the configuration file applet appId list, fill in a maximum of 10.
usingComponents
Developer Tools 1.02.1810190 and above support
Here declared as a global custom components custom components, pages within the applet or custom components that can be used without further statement.
permission
micro-channel client 7.0.0 and above support
Small program interface permission settings. Field type Object
, structure:
Attributes | Types of | Mandatory | Defaults | description |
---|---|---|---|---|
scope.userLocation | PermissionObject | no | Location permissions statement |
Attributes | Types of | Mandatory | Defaults | Explanation |
---|---|---|---|---|
desc | string | Yes | Show getting permission to use a small program interface description. A maximum of 30 characters |
{
"pages": ["pages/index/index"],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位
}
}
}
indicate the location of sitemap.json; default 'sitemap.json' app.json i.e. the same directory name of the file sitemap.json
Configuration Example
{
"pages": ["pages/index/index", "pages/logs/index"],
"window": {
"navigationBarTitleText": "Demo"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
},
{
"pagePath": "pages/logs/logs",
"text": "日志"
}
]
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"debug": true,
"navigateToMiniProgramAppIdList": ["wxe5f52902cf4de896"]
}
base library 2.8.0 started to support low version is compatible with processing to be done.
Micro-channel client 7.0, UI interface has been major revision. Applet also upgrade the basic components of style. app.json configure "style": "v2" may indicate enable the new style of components.
The changes in the components involved are button
icon
radio
checkbox
switch
slider
. You can go to experience a small example program.
useExtendedLib
Infrastructure Library 2.2.1 started to support low version is compatible with processing to be done.
The latest nightly version of the developer tools began to support, but support from the underlying library from version (2.2.1) supports the npm
Specified extensions need to reference. Currently supports the following projects:
kbone: multiport development framework
weui: WeUI component library
When specified, equivalent to the introduction of the latest version of the corresponding extensions related npm package, while not occupying a small volume package program. Currently it does not support references in subcontracting. Usage is as follows:
{
"useExtendedLib": {
"kbone": true,
"weui": true
}
}
Chat messages open position with a taxi class small program, details of reference.
"entranceDeclare": {
"locationMessage": {
"path": "pages/index/index",
"query": "foo=bar"
}
}