大部分的配置都是後端來處理,所以我這裏只說前端拿到後臺返回的form表單信息該如何處理。
調用後臺接口返回結果處處理:
if (res.code == 200) {
let routerData = this.$router.resolve({path:'/payGateWay',query:{ htmlData: res.data.html}})
// 打開新頁面
window.open(routerData.href, '_ blank')
}
然後payGateWay.vue這個頁面:
<template>
<div v-html = "payGateWay">{{payGateWay}}</div>
</template>
<script>
export default {
name: 'payGateWay',
data(){
return {
payGateWay:''
}
} ,
mounted () {
let form = this.$route.query.htmlData
this.payGateWay = form
this.$nextTick(()=> {
document.getElementById('paymentSubmit').submit()
})
}
}
</script>
到此就可以了。