// 点击下载文件
downloadFile(item) {
this.contextFile.index = -1;
item.path = item.path.replace(/^http:/,"https:");
this.download(item.path, item.title);
},
download (src, fileName) {
let x = new XMLHttpRequest();
x.open("GET", src, true);
x.responseType = 'blob';
x.onload = function(e) {
let url = window.URL.createObjectURL(x.response)
let a = document.createElement('a');
a.href = url
a.download = fileName
a.click()
}
x.send();
},
vue 点击事件 点击下载文件
最新推荐文章于 2025-07-17 10:56:20 发布