Jump
exitMiniProgram
TIP
The API usage is as follows: wx.exitMiniProgram(Object object)
- Functional description: Exit the current applet. A single click is required for the call to succeed.
- Parameters and descriptions: Object object。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback function for interface call completion (executed regardless of success or failure) |
navigateToMiniProgram
TIP
The API usage is as follows: wx.navigateToMiniProgram(Object object)
- Functional description: Open another applet
- Parameters and descriptions: Object object。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| appId | string | - | Yes | The appId of the applet to be opened |
| path | string | - | No | The path of the page to be opened. If it is empty, the home page will be opened. The part after ? in the path will become the query. App.onLaunch,App.onShow Page.onLoad The callback function or wx.getLaunchOptionsSyncYou can get the query data in |
| extraData | object | - | No | The data that needs to be passed to the target mini program. The target mini program can obtain this data in App.onLaunch and App.onShow. |
| envVersion | string | release | No | The version of the mini program to be opened. This parameter is valid only when the current mini program is a development version or a trial version. If the current mini program is a formal version, the mini program opened must be a formal version. Its legal values 1.develop: Development version 2trial: Experience version 3.release: Official version |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback function for interface call completion (executed regardless of success or failure) |
Usage restrictions.
Require user to trigger jump
If the user does not click anywhere on the mini program page, the developer will not be able to call this interface to automatically jump to other mini programs.
User confirmation is required to jump
Before jumping to other mini programs, a pop-up window will be added to ask whether to jump. Only after the user confirms can the jump to other mini programs be made. If the user clicks cancel, the fail cancel callback will be called.
The number of other mini programs that each mini program can jump to is limited to no more than 10.
When the developer submits the new version of the mini program code, if the jump to other mini programs function is used, the list of mini programs to be jumped to must be declared in the code configuration, which is limited to no more than 10, otherwise it will not pass the review. The list can be updated when the new version is released, and dynamic modification is not supported. For more information about the configuration method, seeConfiguration。,When calling this interface, the appId to be redirected must be in the configuration list, otherwise the callback will fail. fail appId "${appId}" is not in navigateToMiniProgramAppIdList
- Sample code:
wx.navigateToMiniProgram({
appId: '',
path: 'page/index/index?id=123',
extraData: {
foo: 'bar'
},
envVersion: 'develop',
success(res) {
// open success
}
})navigateBackMiniProgram
TIP
The API usage is as follows: wx.navigateBackMiniProgram(Object object)
- Functional description: Return to the previous applet. The call can only be successful when the current applet is opened by another applet.
- Parameters and descriptions: Object object。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| extraData | Object | {} | No | The data that needs to be returned to the previous mini program, and the previous mini program can get this data in App.onShow |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback function for interface call completion (executed regardless of success or failure) |
- Sample code:
wx.navigateBackMiniProgram({
extraData: {
foo: 'bar'
},
success(res) {
// back success
}
})