fetch(url).then(res => res.blob()).then(blob => { const a = document.createElement('a') document.body.appendChild(a) a.style.display = 'none' const url = window.URL.createObjectURL(blob) a.href = url a.download = '' a.click() document.body.removeChild(a) window.URL.revokeObjectURL(url) })
标签:body,const,url,blob,document,fetch,下载 From: https://www.cnblogs.com/newBugs/p/16970914.html