IE11浏览器导出Excel问题
其中res为后端返回的数据流,该段代码在chrome浏览器正常工作,ie11却提示 无法触发下载,有没有可用解决方法,谢谢
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let downloadElement = document.createElement('a')
let href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = '用户数据.xls'
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
2 回复
js-file-download包,很简单的代码,copy下来试下
https://github.com/kennethjiang/js-file-download/blob/master/file-download.js
@betgar 感谢👍