一、初始化onLoad调用
// 跳转微信小程序
plus.share.getServices((s) => {
var shares = {};
for (var i = 0; i < s.length; i++) {
var t = s[i];
shares[t.id] = t;
}
this.sweixin = shares['weixin'];
}, function(e) {
console.log("获取分享服务列表失败:" + e.message);
})
二、跳转
this.sweixin ? this.sweixin.launchMiniProgram({
//微信小程序原始id
id: '',
path:"/pages/pay-wechat/pay-wechat?orderId=" + data,
}) : console.log('当前环境不支持微信操作!');
其中id为微信小程序原始id,path为跳转小程序的路径,也可以进行路径传参。
三、微信小程序返回APP
<button open-type="launchApp" app-parameter="error" binderror="launchAppError"
class="dialog-wrap__btn" bindtap="cancel">确定</button>