Property | Type | Default value | Required | Description |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
Property | Type | Default value | Required | Description |
appId | string | - | True | The appId of the mini program to open. |
path | string | - | False | The page path to open. If empty, the home page is opened. The string after the ? in the path will become a query, and the query data can be obtained in the mini program’s callback functions App.onLaunch, App.onShow and Page.onLoad, or in wx.getLaunchOptionsSync. |
extraData | object | - | False | Data to pass to the target mini program. It can be obtained in App.onLaunch and App.onShow . |
envVersion | string | release | False | The version of the mini program to open. This parameter is valid only when the current mini program is in development version or Preview. If the current mini program is the released version, the mini program that is opened must be the released version. Valid values: develop: The development version trial: The preview release: The released version |
urlContent | string | - | False | The URL content of the mini program to open. Accepts links such as scan results from wx.scanCode. When both appId and urlContent are provided, urlContent takes priority. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
fail cancel.fail appId "${appId}" is not in navigateToMiniProgramAppIdList.wx.navigateToMiniProgram({appId: '',path: 'page/index/index?id=123',extraData: {foo: 'bar'},envVersion: 'develop',urlContent: '',success(res) {// Navigation to mini program successful}});
Property | Type | Default value | Required | Description |
extraData | Object | {} | False | Data to return to the previous mini program. The previous mini program can access this data in App.onShow. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
wx.navigateBackMiniProgram({extraData: {foo: 'bar'},success(res) {// Returned to previous mini program successfully}})
Property | Type | Default value | Required | Description |
appId | string | - | True | The appId of the mini program to open. |
path | string | - | False | The page path to open. If empty, the home page is opened. The string after the ? in the path will become a query, and the query data can be obtained in the mini program's callback functions. |
extraData | object | - | False | Data to be passed to the target mini program. The target mini program can access this data through App.onLaunch or App.onShow. |
envVersion | string | release | False | The version of the mini program to open. This parameter is effective only when the current mini program is a development or trial version. If the current mini program is a release version, the opened mini program will also be a release version. Valid values: develop: The development version trial: The preview release: The released version |
urlContent | string | - | False | The URL content of the mini program to open. Accepts links such as scan results from wx.scanCode. When both appId and urlContent are provided, urlContent takes priority. |
noRelaunchIfPathUnchanged | boolean | false | False | To open the target mini-program directly at the page where it was last suspended in the background (without restarting), the following conditions must be met: 1. The target mini-program's lifecycle has not been destroyed. 2. The `path` and `query` parameters of the current launch are identical to those of the previous launch. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function for API calls (called on both success and failure). |
wx.openEmbeddedMiniProgram({appId: '',path: 'page/index/index?id=123',extraData: {foo: 'bar'},envVersion: 'release',success(res) {// Opened successfully}})
Property | Type | Description |
height | number | Visible height. |
initialHeight | number | Initial height of the embedded mini program. |
const listener = function (res) {console.log(res.height)console.log(res.initialHeight)}wx.onEmbeddedMiniProgramHeightChange(listener)
const listener = function (res) {console.log(res)}wx.onEmbeddedMiniProgramHeightChange(listener)wx.offEmbeddedMiniProgramHeightChange(listener) // Must pass the same function reference that was used when subscribing
Property | Type | Default value | Required | Description |
path | string | - | False | The page path to open after restart. If omitted, the entry page configured in app.json is opened. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function for API calls (called on both success and failure). |
wx.restartMiniProgram({path: 'pages/index/index',success(res) {// Restarted successfully}})
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan