Global configuration
The 'app.json' file in the root directory of the MiniApp is used to configure the Mini App globally. The contents of the file are a JSON object.
Extended functionality
You can create an 'app.ext.json' file. This file is merged with 'app.json' to prioritize the configuration in 'app.ext.json' (same for pages and components)
# 1. Configuration items
| Properties | Type | Required | Description | Minimum version |
|---|---|---|---|---|
| entryPagePath | string | No | The Mini App starts the Home | by default |
| pages | string[] | Yes | Page Path List | |
| window | Object | No | The default window representation globally | |
| tabBar | Object | No | The performance of the bottom tab bar is | |
| networkTimeout | Object | No | Network timeout | |
| debug | boolean | No | If debug mode is enabled, the | is turned off by default |
| subpackages | Object[] | No | The subcontracting structure configures the | 2.10.1 |
| plugins | Object | No | Use the plug-in | 2.11.1 |
| preloadRule | Object | No | The subpacking pre-download rule | 2.11.1 |
| resizable | boolean | No | Whether the PC MiniApp supports users to arbitrarily change the window size (including maximizing the window); Whether the iPad MiniApp supports screen rotation. | is turned off by default 2.3.0 |
| usingComponents | Object | No | The global custom component configuration | |
| style | string | No | Specifies the use of the upgraded weui style | 2.11.1 |
| useExtendedLib | Object | No | Specifies the extension library | that needs to be referenced 2.12.2 |
| darkmode | boolean | No | The MiniApp supports DarkMode | 2.11.8 |
| themeLocation | string | No | Indicates the location of theme.json, with darkmode as true as required | 2.11.8 |
| Name | Feature Description |
# entryPagePath
Specifies the default startup path (home page) of the MiniApp, and if not filled in, it will default to the first item in the pages list. The strip page path parameter is not supported.
# pages
Used to specify which pages the MiniApp consists of, each of which corresponds to the path (including file name) information of a page. The file name does not need to write the file suffix, the framework will automatically find the corresponding location of the .json, .js, .fxml, .ftss four files to process.
When entryPagePath is not specified, the first item in the array represents the initial page (home page) of the MiniApp.
New/reduced pages in the Mini App require modifications to the pages array.
For example, the development directory is:
You need to write it in app.json
# window
Used to set the status bar, navigation bar, title, and window background color of the MiniApp.
| Properties | Type | The default value is | Description | Minimum version |
|---|---|---|---|---|
| navigationBarBackgroundColor | HexColor | #000000 | The navigation bar background color, such as #000000 | |
| navigationBarTextStyle | string | white | Navigation bar title color, only black/white | is supported |
| navigationBarTitleText | string | Navigation bar title text content | ||
| navigationStyle | string | default | Navigation bar style, only the following values are supported: 1. default(default style), 2. custom (custom navigation bar, keep only the upper right corner button), 3.hide (hide navigation bar and upper right corner capsule) | |
| backgroundColor | HexColor | #ffffff | The background color of the window is | |
| backgroundTextStyle | string | dark | The style of drop-down loading, which only supports dark/light | |
| backgroundColorTop | string | #ffffff | Background color of the top window, only iOS supports | |
| backgroundColorBottom | string | #ffffff | Background color for the bottom window, only iOS supports | |
| enablePullDownRefresh | boolean | false | Whether to enable global pull-down refresh. See page.onPullDownRefresh | |
| pageOrientation | string | portrait | Screen rotation settings, support auto/portrait/landscape, see Response to display area changes | 2.4.0 (auto) / 2.5.0 (landscape) |
| initialRenderingCache | string | The initial rendering cache configuration of the page supports static/dynamic | 2.10.1 | |
| onReachBottomDistance | The bottoming event on the page is triggered at the bottom of the page in px. See Page.onReachBottom | 2.12.8 | ||
| Name | Feature Description | |||
| --- | --- | |||
| restartStrategy | Restart the Policy Configuration | |||
| visualEffectInBackground | When you cut into the system background, you hide the page content to protect user privacy. Supports hidden /none |
# tabBar
TabBar is used to configure the style of the tab navigation bar at the bottom or top of the Mini App and the page to which it jumps.
The detailed configuration items are as follows:
| Properties | Type | Required | The default value is | Description |
|---|---|---|---|---|
| color | HexColor | Yes | The default color for text on tab is | |
| selectedColor | HexColor | Yes | The color | |
| backgroundColor | HexColor | Yes | The background color of tab is | |
| borderStyle | String | No | black | The color of the top border of the tabbar, only black, white, |
| list | Array | Yes | A list of tabs, as described in the list property, supports 2-5 tab options | |
| position | String | No | bottom | The tabBar position supports only two values: bottom, top, |
where list is an array type, only a minimum of 2 tabs and a maximum of 5 tabs can be configured.
Tab is sorted in the order of an array, and each item is a separate object with the following configurable values:
| Properties | Type | Required | Description |
|---|---|---|---|
| pagePath | String | Yes | The path to the page, which must first be defined in the pages array |
| text | String | Yes | Tab the button text |
| iconPath | String | No | Image path, icon size is limited to 40kb, the recommended size is 81px * 81px, network images are not supported. When postion is top, icon is not displayed. |
| selectedIconPath | String | No | When selected, the image path is required to be |
# networkTimeout
The timeout period for various types of network requests, in milliseconds.
| Properties | Type | Required | The default value is | Description |
|---|---|---|---|---|
| request | number | No | 60000 | The timeout for wx.request in milliseconds. |
| connectSocket | number | No | 60000 | The timeout for wx.connectSocket in milliseconds. |
| uploadFile | number | No | 60000 | The timeout for wx.uploadFile in milliseconds. |
| downloadFile | number | No | 60000 | The timeout for wx.downloadFile in milliseconds. |
# debug
Boolean type, when configured to true, after scanning the code, an information viewing button vconsoel will be added to the Mini App to facilitate developers to view logs
# subpackages
When you enable package loading, declare the project package structure.
# plugins
Declare the plugin that the MiniApp needs to use.
# preloadRule
Declares a rule for subcontracting pre-downloads.
# resizable
MiniApps running on iPad can be set to support screen rotation.
A Mini App running on a PC allows the user to drag the window size at any scale or maximize the window in the MiniApp menu
# usingComponents
Custom components declared in 'app.json' are considered global custom components and can be used directly in pages or custom components within the MiniApp without having to declare them.
Note: Custom components declared globally are considered dependent by all pages, are initialized when all pages are started, and occupy the main package size. Custom components that are referenced only by individual pages or subparagraphs should be declared in the page configuration whenever possible.
# style
# useExtendedLib
Specifies the extension library that needs to be referenced. The following projects are currently supported:
When specified, it is equivalent to introducing the latest version of the npm package related to the corresponding extension library, and does not occupy the package volume of the Mini App. The usage is as follows:
# darkmode
SDK version 2.35.1 officially supports DarkMode, you can configure "darkmode": true indicates that the current Mini App can adapt to DarkMode, all basic components will show different default styles according to the system theme, navigation bar and tab bar will also automatically switch according to the developer's configuration.
After configuration, complete the adaptation work other than the basic style by yourself.
At present, Neuxnet android is implemented through inverted color, please test before using.
Specifically, some of the components of the base library in dark mode are inconsistent with ios, WXSS cannot use prefers-color-scheme, and the rest of the functions are normal.
# themeLocation
Customize the path of 'theme.json', when configuring ''darkmode':true', the current configuration file is required.