https://opensupport.alipay.com/support/home.htm
handleAliPay(){ if (/MicroMessenger/.test(window.navigator.userAgent)) { console.log('handleAliPay 微信客户端'); } else if (/AlipayClient/.test(window.navigator.userAgent)) { console.log('handleAliPay 支付宝客户端'); } else { console.log('handleAliPay 其他浏览器'); }; //请求后台的支付接口 this.$u.api.alipage({outTradeNo:new Date().getTime()}) .then(res=>{ let divForm = document.getElementsByTagName('divform') if (divForm.length) { document.body.removeChild(divForm[0]) } const div = document.createElement('divform') div.innerHTML = res.data // res.data就是sb支付宝返回给你的form document.body.appendChild(div); // document.forms[0].setAttribute('target', '_blank') // 加了_blank可能出问题所以我注释了 document.punchout_form.submit(); // document.getElementById('alipay_submit').submit(); console.log('alipage',res); }).catch(err=>{ console.log('alipage err',err); }) },