// 调用接口
api.Download({}).then((data) => {
const link = document.createElement('a')
let blob = new Blob([data], { type: 'application/vnd.ms-excel' })// 生成blob对象
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
link.setAttribute('download', 'xxx' + '.xlsx') // 下载的文件名以及文件格式
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
前端下载文件
最新推荐文章于 2024-09-14 18:52:56 发布