目录
兼容性:企业微信 3.0.36 开始支持
跳转到小程序。
ww.launchMiniprogram({
appid: 'wx062f7a5507909000',
path: 'pages/home/index'
})
本接口必须使用应用身份进行注册
跳转的小程序必须属于页面所属的企业
跳转的小程序必须已关联到工作台
应用必须与要跳转的小程序应用同属于一个企业
跳转的小程序必须已经关联到工作台
属性 | 类型 | 必填 | 说明 | |
---|---|---|---|---|
appid | string | 是 | 跳转的小程序 appid | |
path | string | 否 | 跳转的小程序内页面路径及参数 | |
success | Function | 否 | 成功回调 | |
fail | Function | 否 | 失败回调 | |
cancel | Function | 否 | 取消回调 | |
complete | Function | 否 | 完成回调 |
Promise<Object>
属性 | 类型 | 必填 | 说明 | |
---|---|---|---|---|
errMsg | string | 是 | 通用错误信息 | |
errCode | number | 是 | 通用错误码 |
打开小程序时如果需要关闭页面,需同步调用 closeWindow,不推荐用 setTimeout 延迟关闭。
wx.invoke('launchMiniprogram', {
"appid" : "wx062aaa5507909631", // 需跳转的小程序appid
"path" : "pages/home/index.html", // 所需跳转的小程序内页面路径及参数。非必填
}, function(res) {
if(res.err_msg == "launchMiniprogram:ok") {
// 正常
} else {
// 错误处理
}
}
);