form表单的方式实现下载流类型文件

171 阅读1分钟

downInfoTemplate(batchId) {
      let tempForm = document.createElement('form')
      tempForm.action = 'xxx'
      tempForm.target = '_blank'
      tempForm.method = 'post'
      tempForm.style.display = 'none'
      let opt = document.createElement('textarea')
      opt.name = 'batchId'
      opt.value = batchId
      tempForm.appendChild(opt)
      document.body.appendChild(tempForm)
      tempForm.submit()
    }