this.axios({
  methods: 'get',
  url: url,
  responseType: 'blob'
}).then(res => {
  const blob = new Blob([res])
  const fileName = '导出信息.xls'
  if ('download' in document.createElement('a')) { // 非IE下载
    const elink = document.createElement('a')
    elink.download = fileName
    elink.style.display = 'none'
    elink.href = URL.createObjectURL(blob)
    document.body.appendChild(elink)
    elink.clink()
    URL.revokeObjectURL(elink.href) // 释放URL 对象
    document.body.removeChild(elink)
  } else { // IE10+下载
    navigator.msSaveBlob(blob, fileName)
  }
})

 

相关文章:

  • 2021-05-31
  • 2021-06-15
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-28
  • 2021-12-04
  • 2021-05-10
猜你喜欢
  • 2022-02-06
  • 2021-08-03
  • 2022-12-23
  • 2021-07-16
  • 2022-02-10
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案