Vue 下载 blob 流文件
// 下载文件
showFile(item) {
this.$http({
method: 'post',
url: '/fileApi/downLoadFile',
responseType: 'blob',
data: {
'flieName': item.fileName
},
}).then(data => {
if (!data) {
return
}
let link = document.createElement('a')
link.href = window.URL.createObjectURL(new Blob([data.data], {
type: "application/x-xls"
}))
link.target = '_blank'
link.download = decodeURI(item.fileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
},