Configuring Mini Program

Global Configuration

The app.json file in the Mini Program directory is used to apply global configuration to Weixin Mini Programs, determine page file paths and window behaviors, set the network timeout, and set multiple tabs.

For details of configuration items, see Mini Program Global Configuration.

Here is an app.json file that contains some commonly used configuration options:

{
  "pages": [
    "pages/index/index",
    "pages/logs/index"
  ],
  "window": {
    "navigationBarTitleText": "Demo"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "Home"
    }, {
      "pagePath": "pages/logs/logs",
      "text": "Log"
    }]
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000
  },
  "debug": true,
  "navigateToMiniProgramAppIdList": [
    "wxe5f52902cf4de896"
  ]
}

For details of configuration items, see Mini Program Global Configuration.

Page Configuration

For each Mini Program page, the .json file named after the Mini Program can also be used to configure the window behaviors of this page. The configuration items in the page will overwrite the same window configuration items in app.json.

For details of configuration items, see Mini Program Page Configuration.

For example:

{
  "navigationBarBackgroundColor": "#ffffff",
  "navigationBarTextStyle": "black",
  "navigationBarTitleText": "Weixin API feature demo",
  "backgroundColor": "#eeeeee",
  "backgroundTextStyle": "light"
}