this.$axios.get(wxPay,{ params:{ order_pay_no:this.order_pay_no,//订单编号 payment_type:1//支付类型 } }).then((res)=>{ this.loadS=false if(parseInt(res.data.errCode)>=0){ this.sData=res.data.data.jsApiParameters this.payMoney() }else{ this.toast = this.$createToast({ txt: ‘调用微信支付数据失败‘, type: ‘txt‘ }).show() } }).catch((err)=>{ console.log(err) })
payMoney(){//调用微信的请求方法 let vm = this; if (typeof window.WeixinJSBridge == ‘undefined‘) { if (document.addEventListener) { document.addEventListener(‘WeixinJSBridgeReady‘, vm.onBridgeReady(vm.sData), false) }else if (document.attachEvent) { document.attachEvent(‘WeixinJSBridgeReady‘, vm.onBridgeReady(vm.sData)) document.attachEvent(‘onWeixinJSBridgeReady‘, vm.onBridgeReady(vm.sData)) } } else { vm.onBridgeReady(vm.sData) } },
原文:https://www.cnblogs.com/rouyhx/p/14716794.html