h5嵌套小程序、app端传参写法

var order_code = result.data
var terminal = $('#terminal').val()
if(terminal == 1){
// 小程序
wx.miniProgram.getEnv(function (res) {
if(res.miniprogram){
wx.miniProgram.navigateTo({
url:'/pages/payresult/cashier/cashier'+'?order_code='+ order_code + '&price=' + price
})
}
})
}else if(terminal == 2){
// ios 注意 ios传参是字符串  不是字符串记得转换一下
order_code = order_code.toString()
price = price.toString()
_data = {
'order_code': order_code,
'price': price
}
try{

//goPayMember自己起的 和ios端对应好
window.webkit.messageHandlers.goPayMember.postMessage(_data);
}catch (e){
tconsole(e.message)
}
}else if(terminal == 3){
order_code = order_code.toString()
price = price.toString()
// android
try{

//BigoffsPromotion.goPayMember自己起的和安卓端对应好
BigoffsPromotion.goPayMember(order_code,price)
}catch (e){
tconsole(e.message)
}

}

原文地址:https://www.cnblogs.com/yaoling/p/13615242.html