a标签下载的两种方法

【a标签下载的两种方法】1、
下载1
2、

下载2download(){ let url = '/files/文件.zip' let filename = '下载的文件名称' return fetch(url).then(res => res.blob().then(blob => { let a = document.createElement('a'); let url = window.URL.createObjectURL(blob); console.log(url); a.href = https://www.it610.com/article/url; a.download = filename; a.click(); window.URL.revokeObjectURL(url); })) }

    推荐阅读