vue中调取支付宝支付接口,后台返回form表单前端处理

前言:

        在项目中,支付功能是一个常见的功能,调用支付宝时,后段给我们的是一个form的富文本内容,分享下使用方法

方法:

this.$api.abc().then(res=>{

  //  res.data.data默认是我们拿到的form代码
  const div = document.createElement('div') 
  div.innerHTML = res.data.data 
  document.body.appendChild(div)
   document.forms[0].submit() //重要,这个才是点击跳页面的核心


})

 

你可能感兴趣的:(vue-插件,支付功能)