app.json
file in the root directory of the mini program is used for global configuration of the mini program. The file content is a JSON object with the following parameters:attribute | type | required | describe |
string | no | Mini Program default start home page | |
string[] | yes | Page Path List | |
Object | no | Global default window representation | |
Object | no | BOTTOM tab Column performance | |
boolean | no | Whether or not to open debug Mode, off by default | |
Object[] | no | Subcontract structure configuration | |
string | no | Worker Directory for code placement | |
string[] | no | ||
Object | no | Subcontract Predownload Rules | |
Object | no | ||
Object | no | Small Program Interface Permissions Related Settings | |
boolean | no | Mini Program support DarkMode | |
string | no |
{"entryPagePath": "pages/index/index"}
├── app.js├── app.json├── app.wxss├── pages│ │── index│ │ ├── index.wxml│ │ ├── index.js│ │ ├── index.json│ │ └── index.wxss│ └── logs│ ├── logs.wxml│ └── logs.js└── utils
{"pages": ["pages/index/index", "pages/logs/logs"]}
attribute | type | default value | describe |
navigationBarBackgroundColor | HexColor | #000000 | Navigation bar background color, such as #000000 |
navigationBarTextStyle | string | white | Navigation bar header color, support only black / white |
navigationBarTitleText | string | - | Navigation Title Text Content |
navigationStyle | string | default | Navigation bar style supports only the following values default Default Style custom Customize the navigation bar, leaving only the capsule on in the upper right corner. See note 2. |
backgroundColor | HexColor | #ffffff | The background color of the window |
backgroundTextStyle | string | dark | Pull down loading Style, only supports dark / light |
backgroundColorTop | string | #ffffff | The background color of the top window, only iOS Support |
backgroundColorBottom | string | #ffffff | The background color of the bottom window, only iOS Support |
enablePullDownRefresh | boolean | false | |
onReachBottomDistance | number | 50 | The distance from the bottom of the page when the event is triggered, in px.
See for details Page.onReachBottom |
customNavigateBack | Boolean | false | Whether or not you want to intercept the default return of the page (tabBar return or side-swipe or back key return) is used in conjunction with Page.onCustomBack. |
pageOrientation | string | portrait | Screen rotation settings, support car / portrait / landscape
See for details Response to display area changes |
navigationStyle
navigationStyle
only takes effect in app.json.navigationStyle
: custom does not work for the web-view componentattribute | type | required | default | describe |
color | HexColor | yes | - | tab Default color for text on, only hexadecimal color is supported |
selectedColor | HexColor | yes | - | tab Supports hexadecimal colors only |
backgroundColor | HexColor | yes | - | tab Supports only hexadecimal colors |
borderStyle | string | no | black | Tabs The color of the top border, Support only black / white |
list | Array | yes | - | tab For a list of list Property explaination, minimum 2 Most 5 individual tab |
position | string | no | bottom | tabBar Only supports the location of bottom / top |
custom | boolean | no | false |
attribute | type | required | introductions |
pagePath | string | yes | Page path, must be in the pages First definition |
text | string | yes | tab Up on text |
iconPath | string | no | Picture path, icon Size limit is 40kb, recommended size 81px * 81px, does not support web pictures.
when position for top Does not display when icon. |
selectedIconPath | string | no | Selected picture path, icon Size limit is 40kb, recommended size 81px * 81px, does not support web pictures.
when position for top Does not display when icon. |
debug
mode in the developer tool. In the console panel, debug information will be provided as info
, including details on page registration, page routing, data updates, and event triggers. It helps developers quickly troubleshoot some common problems.app.json
are considered global custom components and can be used directly in pages or custom components within the mini program without further declaration. It is recommended to only declare custom components that are used by almost all pages.Object
. Its structure is as follows:attribute | type | required | default | describe |
scope.userLocation | PermissionObject | no | - | Location-dependent permission statement |
attribute | type | Required | Default | Introductions |
desc | string | yes | - | Description of the Chinese usage of the interface displayed by the mini program when obtaining permissions. Maximum 80 characters |
desc-en | string | no | - | Description of the English usage of the interface displayed by the mini program when obtaining permissions. Maximum 80 characters |
desc-adesc-ar | string | no | - | A description of the Arabic usage of the interface displayed when the mini program gets permissions. Maximum 80 characters |
{"pages": ["pages/index/index"],"permission": {"scope.userLocation": {"desc": "Your location information will be used to display the effects of the Mini Program location interface." // Continuous Background Positioning for Freeway Driving}}}
scope | API | Description |
scope.userinfo | wx.getUserInfo | User information |
scope.userLocation | wx.getLocation | Get location information |
scope.userFuzzyLocation | wx.getFuzzyLocation | Get fuzzy location information |
scope.record | live-pusher component or wx.startRecord | live-pusher component or wx.startRecord |
scope.camera | camera component | camera component |
scope.addPhoneCalendar | wx.addPhoneCalendar | Add Calendar |
scope.writePhotosAlbum | wx.saveImageToPhotosAlbum | Save Image to Photos Album |
scope.bluetooth | wx.openBluetoothAdapter | Bluetooth |
"darkmode" to true
, you can enable dark mode in the mini program. All basic components will display different default styles according to the system theme, and the navigation bar and tab bar will also automatically switch according to the developer's configuration.{"darkmode": true}
"darkmode": true
is set.{"pages": ["pages/index/index", "pages/logs/index"],"window": {"navigationBarTitleText": "Demo"},"tabBar": {"list": [{"pagePath": "pages/index/index","text": "index"},{"pagePath": "pages/logs/logs","text": "logs"}]},"debug": true}
Was this page helpful?