HomeDocs
Skip to main content

Application Configuration

The app.json file in the root directory of your mini-program is used to configure various global settings for your mini-program. It defines the paths to page files, window behavior, network timeout settings, and more. The file content is a JSON object with the following properties:

Configuration Items

PropertyTypeRequiredDescriptionMinimum Version
pagesObjectYesSpecifies the page paths.1.0.0
windowObjectNoGlobal default window behavior.1.0.0
tabBarObjectNoConfiguration for the bottom tab bar.1.0.0
handleTabBarLoadStringLongitudeCan be configured by developers. Supports dynamic loading of the TabBar style. Default can be left empty or set to "static". See details below.4.0.0

pages

This property is used to specify the pages that make up the mini-program. Each item corresponds to a page path (including the file name). You don't need to include file extensions; the framework will automatically find the corresponding .json, .js, .dlt, and .css files in the specified location.

The first item in the array represents the mini-program's initial page (home page). When you add or remove pages in your mini-program, you need to modify the pages array accordingly.

For example, if your project directory structure looks like this:

├── app.js
├── app.json
├── app.css
├── pages
│ ├── index
│ │ ├── index.dlt
│ │ ├── index.js
│ │ ├── index.json
│ │ └── index.css
│ └── logs
│ ├── logs.dlt
│ └── logs.js
└── utils

Then you need to set the pages property in app.json like this:

{
"pages": ["pages/index/index", "pages/logs/logs"]
}

window

This property is used to set the status bar, navigation bar, title, and window background color for the mini-program.

PropertyTypeRequiredDefaultDescriptionMinimum Version
enablePullDownRefreshBooleanNofalseWhether to enable pull-down refresh.1.0.0
enablePullUpRefreshBooleanNofalseWhether to enable pull-up refresh.1.0.0
enableTransparentStatusBarBooleanNofalseWhether to enable transparent TitleBar immersive status bar.1.0.0
enableNavigationBarLoadingBooleanNotrueWhether to enable the TitleBar loading progress bar.1.0.0
navigationBarTitleTextStringNoDefault page title.1.0.0
navigationStyleStringYesNavigation bar style, supported values are explained below.
navigationBarBackgroundColorHexColorYesNavigation bar and status bar background color, e.g., "#FFFFFF".1.0.0
navigationBarTextStyleStringYesNavigation bar and status bar text color, only supports black/white.1.0.0
navigationBarIconStyleStringYesNavigation bar icon color type, only supports black/white.1.0.0
navigationBarHomeActionStringNohomeNavigation bar Home button action, only supports home/back/all. See explanations below.1.0.0
refreshHeaderStyleStringNoRefresh header style:
- default: Default style
- custom: Custom refresh header.
Custom refresh header must have four properties: refreshHeaderCustomLoadingGif, refreshHeaderCustomSuccessGif, refreshHeaderCustomLoading, and refreshHeaderCustomSuccess, and they must meet the requirements to be set successfully, otherwise the default refresh header will be used.
1.0.0
refreshHeaderCustomTextEnableBooleanNoWhether to display the refresh text. Only valid when a custom refresh header is enabled.1.0.0
refreshHeaderCustomLoadingGifStringNoCustom refresh header loading animation, must be a gif image and will loop. Supports images within the mini-program package only. Only valid when a custom refresh header is enabled.1.0.0
refreshHeaderCustomSuccessGifStringNoCustom refresh header success animation, must be a gif image and plays once. Supports images within the mini-program package only. Only valid when a custom refresh header is enabled.1.0.0
refreshHeaderCustomLoadingStringNoCustom refresh header loading static placeholder image. Supports images within the mini-program package only. Only valid when a custom refresh header is enabled.1.0.0
refreshHeaderCustomSuccessStringNoCustom refresh header success static placeholder image. Supports images within the mini-program package only. Only valid when a custom refresh header is enabled.1.0.0
refreshHeaderTranslationContentBooleanNotrueWhether to enable content view drag effect. When the content view is enabled, the Header refresh start display will be based on the status bar height.1.0.0
refreshHeaderAccentColorHexColorNoRefresh header text color, effective when refresh component is enabled, e.g., "#000000".1.0.0
refreshHeaderBackgroundColorHexColorNoRefresh header background color, effective when refresh component is enabled, e.g., "#000000".1.0.0
refreshHeaderDelayedNumberNoTimeout to stop pull-down refresh, default is not enabled, greater than 0 is effective, unit: ms.1.0.0
refreshFooterAccentColorHexColorNoRefresh footer text color, effective when refresh component is enabled, e.g., "#000000".1.0.0
refreshFooterBackgroundColorHexColorNoRefresh footer background color, effective when refresh component is enabled, e.g., "#000000".1.0.0
refreshFooterDelayedNumberNoTimeout to stop pull-up refresh, default is not enabled, greater than 0 is effective, unit: ms.1.0.0
contentBackgroundColorHexColorNoMain page background color, e.g., "#000000".1.0.0
enablePageLoadingBooleanNofalsePage transition Loading.1.0.0
enableTabBarAdjustPanBooleanNofalseFor pages with a TabBar and input tags, it supports not lifting the TabBar when the keyboard is displayed.4.1.0
darkModeNavigationBarBackgroundColorHexColorNoDark mode navigation bar and status bar background color, e.g., #00000000.6.0.0
darkModeNavigationBarTextStyleStringNoDark mode navigation bar and status bar text color, supports black / white only.6.0.0
darkModeNavigationBarIconStyleStringNoDark mode navigation bar icon color type, supports black / white only.6.0.0
darkModeContentBackgroundColorHexColorNoDark mode main page background color, e.g., #000000.6.0.0
  • Note 1: HexColor (hexadecimal color value), e.g., "#ff00ff"

navigationBarHomeAction Supported Values

Supported ValuesDescriptionMinimum Version
homeSmall house button, returns to the main page1.0.0
backLeftward return arrow, returns one level only1.0.0
allDisplay both the return and small house icons1.0.0

Supported Values for navigationStyle

Supported ValuesDescriptionMinimum Version
defaultDefault style1.0.0
hideHide the navigation bar and only keep the capsule button (in this mode, navigationBarTextStyle and navigationBarIconStyle don't work, including corresponding API calls).3.0.0
customCustom navigation bar (only in this mode, enableTransparentStatusBar, navigationBarBackgroundColor, navigationBarTextStyle, navigationBarIconStylenavigationBarHomeAction, can take effect, including corresponding API calls).1.0.0

tabBar

PropertyTypeRequiredDefaultDescriptionMinimum Version
colorHexColorYesDefault text color on tabs, supports hexadecimal colors1.0.0
selectedColorHexColorYesText color on selected tab, supports hexadecimal colors1.0.0
backgroundColorHexColorYesBackground color of the tab bar, supports hexadecimal colors1.0.0
borderStyleStringNoblackColor of the top border on the tab bar, supports black / white1.0.0
listArrayYesList of tabs, see details below for the list property1.0.0
positionStringNobottomPosition of the tabBar, only supports bottom, not top1.0.0
customBooleanNofalseCustom tabBar, custom support not yet available1.0.0

Details of the list Property

The list property accepts an array that can only configure a minimum of 2 and a maximum of 5 tabs. Tabs are sorted in the order specified in the array, and each item is an object with the following properties:

PropertyTypeRequiredDescription
pagePathStringYesPage path, must be defined in the pages array first
textStringYesButton text on the tab
iconPathStringNoImage path, icon size is limited to 40kb, recommended size is 81px * 81px, supports network images. When position is set to top, the icon is not displayed.
selectedIconPathStringNoImage path when selected, icon size is limited to 40kb, recommended size is 81px * 81px, supports network images. When position is set to top, the icon is not displayed.

Configuration Example

{
"pages": ["pages/components/components", "pages/api/api", "pages/case/case"],
"window": {
"navigationBarTitleText": "MiniApp Official Demo",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white",
"navigationStyle": "default",
"enablePullDownRefresh": false,
"enablePullUpRefresh": false,
"enableAddScreen": false,
"enableNavigationBarLoading": false,
"darkModeNavigationBarBackgroundColor": "#000000",
"darkModeNavigationBarTextStyle": "white",
"darkModeNavigationBarIconStyle": "white",
"darkModeContentBackgroundColor": "#000000"
},
"tabBar": {
"list": [
{
"pagePath": "pages/components/components",
"text": "Components",
"iconPath": "images/component_normal.png",
"selectedIconPath": "images/component_selected.png"
},
{
"pagePath": "pages/api/api",
"text": "API",
"iconPath": "images/api_normal.png",
"selectedIconPath": "images/api_selected.png"
},
{
"pagePath": "pages/case/case",
"text": "Our Product",
"iconPath": "images/smtui_normal.png",
"selectedIconPath": "images/smtui_selected.png"
}
],
"backgroundColor": "#ffffff",
"borderStyle": "white",
"color": "#92969e",
"selectedColor": "#191f2b",
"position": "bottom",
"custom": false
}
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.