W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
跳轉(zhuǎn)到另一個(gè)小程序
繼承標(biāo)準(zhǔn)對象輸入,擴(kuò)展屬性描述:
屬性 | 類型 | 必填 | 默認(rèn)值 | 說明 | 最低支持版本 |
---|---|---|---|---|---|
appId | string | 是 | 要跳轉(zhuǎn)的小程序 id | 1.15.0 | |
path | string | 否 | 要跳轉(zhuǎn)的小程序頁面路徑(不傳則默認(rèn)打開首頁),允許攜帶 query 參數(shù),格式詳見示例 | 1.15.0 | |
extraData | object | 否 | 需要傳遞給目標(biāo)小程序的數(shù)據(jù),目標(biāo)小程序可在 App.onLaunch ,App.onShow ,tt.getLaunchOptionsSync 中獲取到這份數(shù)據(jù)。如果跳轉(zhuǎn)的是小游戲,可以在 tt.onShow 、tt.getLaunchOptionsSync 中可以獲取到這份數(shù)據(jù)數(shù)據(jù) | 1.15.0 | |
envVersion | string | 否 | current | 要打開的小程序版本。合法的值有current --線上版;latest --測試版。僅在當(dāng)前小程序?yàn)殚_發(fā)版或測試版時(shí)此參數(shù)有效。如果當(dāng)前小程序是正式版,則打開的小程序必定是正式版 | 1.15.0 |
success | function | 否 | 接口調(diào)用成功的回調(diào)函數(shù) | 1.15.0 | |
complete | function | 否 | 接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會執(zhí)行) | 1.15.0 | |
fail | function | 否 | 接口調(diào)用失敗的回調(diào)函數(shù) | 1.15.0 |
// app.json
{
...
"navigateToMiniProgramAppIdList": [
"tt2d495bf4b2xxxxxx"
],
...
}
tt.navigateToMiniProgram({
appId: "tt2d495bf4b2xxxxxx",
path: "pages/index/index?arg1=ascii&arg2=" + encodeURIComponent("中文"),
extraData: {
arg3: "hello"
},
success: function() {
that.setData({
success: true
});
},
fail: function(e) {
console.log(e);
that.setData({
success: false
});
}
});
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: