下载fetch
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) })
本文来自博客园,作者:小万子呀,转载请注明原文链接:https://www.cnblogs.com/newBugs/p/16970914.html