//下载附件
down(item) {
let that = this;
axios({
url: 'xxx',
method: 'xxx',
data: {xxx},
responseType: 'blob', // 服务器返回的数据类型
}).then(function (res) {
try {
const objectUrl = URL.createObjectURL(new Blob([res.data]))
const link = document.createElement('a')
link.download = decodeURIComponent(res.headers['content-disposition'].split(';')[1].split('filename=')[1])
link.href = objectUrl
link.click()
window.URL.revokeObjectURL(link.href)
} catch (e) {
alertDanger('下载失败!');
}
})
.catch(function (err) {
alertDanger('下载失败!');
});
},