const donwLoadFn = (arr) => { if (arr.length <= 0) return const fullUrl = `http://192.168.2.50:9803${arr[0]?.filePath}` fetch(fullUrl) .then(res => res.blob()) .then(blob => { const a = document.createElement("a"); const objectUrl = window.URL.createObjectURL(blob); a.download = arr[0]?.fileName; a.href = objectUrl; a.click(); window.URL.revokeObjectURL(objectUrl); a.remove(); }) }
标签:文件,arr,const,URL,objectUrl,js,window,blob,下载 From: https://www.cnblogs.com/Esai-Z/p/17408461.html