try {
// new Blob([data])用来创建URL的file对象或者blob对象
const url =window.URL.createObjectURL(new Blob([res.data], {type:'application/vnd.ms-excel;' }))
// 生成一个a标签
const link =document.createElement('a')
link.style.display ='none'
link.href = url
// 生成时间戳
const timestamp =new Date().getTime()
link.download = timestamp +'数据'
document.body.appendChild(link)
link.click()
}catch (error) {
console.error('download function error!', error)
}
https://blog.csdn.net/weixin_52497098/article/details/123279672
网友评论