# Mini Game Configuration
The game.json
file in the Mini Game root directory is used to configure Mini Games. The file content is a JSON object with the following properties:
# Configuration Items
Property | Type | Required | Default Value | Description | Minimum Version |
---|---|---|---|---|---|
deviceOrientation | String | No | 'portrait' | Screen orientation | |
showStatusBar | Boolean | No | false | Specifies whether to display the status bar | |
networkTimeout | Object | No | - | The timeout time of network requests (in ms) | |
workers | String | No | - | Multi-threaded Worker configuration item. For details, see Worker documentation. | |
subpackages | Object Array | No | - | The subpackage structure configuration | |
navigateToMiniProgramAppIdList | String Array | No | - | The list of Mini Programs to redirect to. For details, see wx.navigateToMiniProgram. | 2.4.0 |
permission | Object | No | - | Mini Game API permission settings | Weixin 7.0.0 |
Valid values of deviceOrientation
Value | Description | Minimum Version |
---|---|---|
portrait | Portrait mode. The screen does not rotate as the phone rotates. | |
landscape | Landscape mode with the Home button on the right side of the screen. If the orientation lock is not turned on, the screen rotates as the phone rotates in the landscape mode. | |
landscapeLeft | Landscape mode with the Home button on the left side of the screen | Weixin 7.0.0 |
landscapeRight | Landscape mode with the Home button on the right side of the screen | Weixin 7.0.0 |
# networkTimeout
The timeout values for various network requests, in milliseconds.
Property | Type | Required | Default Value | Description |
---|---|---|---|---|
request | Number | No | 60000 | The timeout time of wx.request (in ms) |
connectSocket | Number | No | 60000 | The timeout time of wx.connectSocket (in ms) |
uploadFile | Number | No | 60000 | The timeout time of wx.uploadFile (in ms) |
downloadFile | Number | No | 60000 | The timeout time of wx.downloadFile (in ms) |
# workers
When using Worker to process multi-threaded tasks, set a directory to store the Worker
code.
# subpackages
This feature is supported as of Weixin app 6.6.7 and the base library version 2.1.0.
When Subpackage Loading is enabled, the project subpackaging structure is declared.
The field can also be written as subPackages.
# navigateToMiniProgramAppIdList
Start from base library version 2.4.0. Please remaining backward compatible.
When a Mini Program must use the wx.navigateToMiniProgram API to redirect to another Mini Program, you must first declare the appId list for the Mini Program(s) to be redirected to in the configuration file. The appIds for up to 10 Mini Programs can be added.
# permission
This feature is supported as of Weixin app 7.0.0.
Settings for Mini Game API permissions. This is an Object
type field with the following structure:
Property | Type | Required | Default Value | Description |
---|---|---|---|---|
scope.userLocation | PermissionObject | No | The location-related permission declaration. |
PermissionObject structure
Property | Type | Required | Default Value | Description |
---|---|---|---|---|
desc | string | Yes | The API use instructions displayed when a Mini Program obtains permissions. The value is a string of up to 30 characters. |
For example:
{
"permission": {
"scope.userLocation": {
"desc":"Your location information is used to determine the display of the Mini Game location API."
}
}
}
# Configuration Example
{
"deviceOrientation": "portrait",
"networkTimeout": {
"request": 5000,
"connectSocket": 5000,
"uploadFile": 5000,
"downloadFile": 5000
},
"navigateToMiniProgramAppIdList": [
"wxe5f52902cf4de896"
]
}