// 下载文件
Download(row) {
var videoUrlObj = process.env.VUE_APP_BASE_API + "/common/download/resource?resource=/profile/" + row.downloadPath;
this.getBlob(videoUrlObj).then(blob => {
const filename = row.dataName.split("/").pop();
this.DownloadItem(blob, filename);
});
},
getBlob(url) {
return new Promise(resolve => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = () => {
if (xhr.status === 200) {
resolve(xhr.response);
}
};
xhr.send();
});
},
DownloadItem(blob, fileName) {
let link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = fileName + '.zip';
link.click();
},