fetch(fileData.url).then(res => res.blob()).then(blob => {
const a = document.createElement('a')
const url = window.URL.createObjectURL(blob)
a.href = url;
a.download = fileData.name // 文件名
document.body.appendChild(a)
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
})
js 前端通过url地址下载文件
最新推荐文章于 2023-10-16 10:32:18 发布