let url = window.URL.createObjectURL(new Blob([文件流(一般为res.data)], {type: "Blob类型"})
let link = document.createElement('a')
link.style.dispaly = 'none'
link.href = url
link.setAttribute('download', '下载的文件名')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
标签:body,url,link,Blob,document,type,下载
From: https://www.cnblogs.com/shallow-dreamer/p/17065497.html