exportFileHandle (name) {
this.$http({
url: this.$http.adornUrl('/preschool/export/zip'),
method: 'get',
responseType: 'blob',
params: this.$http.adornParams({
'fileName': name
})
}).then(({data}) => {
let nowDate = new Date()
//const blob = new Blob([data],{type: 'application/vnd.ms-excel'})
//let filename = name + '.xls'
const blob = new Blob([data],{type: 'application/zip'})
let filename = '期末总结' + dateFilter(nowDate,1) + '.zip'
const elink = document.createElement('a')
elink.download = filename
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
})
}
vue 下载文件前端代码
最新推荐文章于 2025-09-17 15:46:37 发布
1066

被折叠的 条评论
为什么被折叠?



