HomeDocs
Skip to main content

Open Another Mini Program from the Current Page

methodName: navigateToMiniProgram

Additional Parameters:

PropertyTypeRequiredDefaultDescription
appIdStringYesThe appId of the mini program to open.
pathStringNoThe page path to open in the target mini program. If it's empty, the target mini program's home page will be opened. Any text after ? in the path becomes the query, which can be retrieved using dlt.getLaunchOptions in the target mini program.
extraDataStringNoData to be passed to the target mini program. The target mini program can access this data in App.onLaunch and App.onShow.

Success Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure.

Fail Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure.
errMsgStringError message.

Example Usage

const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();

if (canCallDlt) {
dlt.callApi('navigateToMiniProgram', {
appId: '1xxxx',
path: 'pages/index/index?a=xxx',
extraData: JSON.stringify({ apple: 'red' }),
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.