window.open 被拦截 解决方案

项目中 用axios 请求支付并跳转到支付页面 使用window.open会被chrome 等高级浏览器拦截
网上搜了下 找了一个可行的方案?
surePay() {
this.showcontent = true;
let newTab=window.open('about:blank');
api.pay(this.refsend.type,this.refsend.money).then(response => {
if(response.success&&response.data) {
newTab.location.href = 'http://'+response.data
} else {
window.alert("非法操作");
}
});
}

0 个评论

要回复文章请先登录注册