mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 10:56:46 +08:00
18 lines
390 B
JavaScript
18 lines
390 B
JavaScript
|
|
const blobDownloadFile = (res, fileName) => {
|
|
const blob = new Blob([res])
|
|
const a = document.createElement('a')
|
|
const URL = window.URL || window.webkitURL
|
|
const herf = URL.createObjectURL(blob)
|
|
a.href = herf
|
|
a.download = fileName
|
|
document.body.appendChild(a)
|
|
a.click()
|
|
document.body.removeChild(a)
|
|
window.URL.revokeObjectURL(herf)
|
|
}
|
|
|
|
|
|
|
|
|
|
export default blobDownloadFile |