fileList:[
{
src:'http://storage.xuetangx.com/public_assets/xuetangx/PDF/PlayerAPI_v1.0.6.pdf',
name:'aaa.pdf'
}
]
// 下载全部附件
handleDownloadAllFile() {
this.fileList.forEach((item) => {
this.openDownload("item.src", item.name);
});
},
async openDownload(link, name) {
console.log(link, name, 'link, name');
const x = new XMLHttpRequest();
x.open('GET', link, true);
x.responseType = 'blob';
x.onload = function () {
const url = window.URL.createObjectURL(x.response);
const a = document.createElement('a');
a.href = url;
a.download = name || '';
a.click();
};
x.send();
},