uniapp端:
1.配置manifest
2.app端代码如下
点击按钮执行:
playPay(){
console.log('支付接口')
plus.share.getServices(
(res) => {
console.log("getServices success:", res);
res[2].launchMiniProgram({
id: "gh_1e2f9ac274fb",// 小程序原始id g开头
path: `/pages/index/index?id=100`,
type: 2, // 0正式环境 1测试版 2体验版本
});
},
(err) => {
console.log("getServices err:", err);
}
);
}
3.微信小程序端接收app传参:
onLoad(option) {
this.id = option.id;
},
4.微信小程序传值给app
<button class="bottom" open-type="launchApp" :app-parameter="orderId" @error="launchAppError">返回APP</button>
data() {
return {
orderId:'123456',
}
5.app接收小程序传来值:
onShow(){
let orderId = plus.runtime.arguments;
this.orderId = orderId;
},