urlToBold(url){
let http = url.split('?')[0];
let file = http.split('/');
let fileName = file[file.length - 1];
fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
const aLink = document.createElement('a')
aLink.href = URL.createObjectURL(blob)
// 文件名字
aLink.download = fileName;
document.body.appendChild(aLink)
aLink.click()
aLink.remove();
})
},
vue 文件url转文件流下载方法
于 2023-05-25 09:32:44 首次发布