后端接入手机网页支付api后,前端调用后端给的支付接口会返回一个form表单,这时前端只需要调用表单的submit就能调起支付宝支付页面;
reqCharges().then(r => {
if(r.data.code === 200){
let form = r.data.data;
const div = document.createElement('formdiv');
div.innerHTML = form;
document.body.appendChild(div);
document.forms[0].setAttribute('target', '_self');
document.forms[0].submit();
div.remove();
}
)