文件点击下载
// 点击文件下载,fileUrl为http的url
function downloadFile(fileUrl) {
fetch(fileUrl).then(res => res.blob()).then(blob => {
const a = document.createElement('a')
document.body.appendChild(a)
a.style.display = 'none'
const url = window.URL.createObjectURL(blob)
a.href = url
a.download = fileUrl
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
})
}