1. Wechat applet supports jumping between applet
Condition: Open another applet associated with the same official account. (Note: must be under the same official account, not under the same open account)
2. Interface: wx.navigateToMiniProgram(OBJECT)
OBJECT parameter description:
parameter name | Types of | Required | illustrate |
---|---|---|---|
appId | String | Yes | The applet appId to open |
path | String | no | Open page path, if empty, open the home page |
extraData | Object | no | App.onLaunch() The data that needs to be passed to the target applet , the target applet can App.onShow() obtain this data in . Details |
envVersion | String | no | The applet version to be opened, the valid values are develop (development version), trial (experience version), release (official version), this parameter is only valid when the current applet is the development version or the experience version; if the current applet is the experience version Or the official version, the open applet must be the official version. Default value release |
success | Function | no | Callback function for successful interface call |
fail | Function | no | Callback function for interface call failure |
complete | Function | no | The callback function of the end of the interface call (the call will be executed if it succeeds or fails) |
Description of parameters returned by success:
parameter name | Types of | illustrate |
---|---|---|
errMsg | String | Call result, errMsg:"navigateToMiniProgram:ok" |
3. Example of use:
1. Open the approved applet
wx.navigateToMiniProgram({
appId: 'wxd7a0926d7a3f88d3',
path: 'pages/page2/page2?id=123',
extraData: {
foo: 'bar'
},
success(res) {
console.info(res);
// 打开成功
}
});
2. Open the development version
//运行测试版,只有管理员可以打开,并测试
wx.navigateToMiniProgram({
appId: 'wxda96e53db887bb05',
path: 'pages/page1/page1?id=123',
extraData: {
foo: 'bar'
},
envVersion:'develop',
success(res) {
console.info(res);
// 打开成功
}
});
More:
WeChat applet realizes the function of making calls directly