vue处理文件流 点击下载文件
作者:
吃肉肉不吃肉肉 | 来源:发表于
2021-03-02 14:45 被阅读0次download(item){
this.name=item.class
var that =this
apis.GetFiles({id:item.id}).then(res => {
that.downloadGO(res)
}).catch(() => {
})
},
downloadGO (data) {
if (!data) {
return
}
let url = window.URL.createObjectURL(new Blob([data]))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', this.name)
document.body.appendChild(link)
link.click()
本文标题:vue处理文件流 点击下载文件
本文链接:https://www.haomeiwen.com/subject/ultxqltx.html
网友评论