axios.get("URL",{ params:{ data1:data1, data2:data2 }, headers: { ‘Content-Type‘: ‘application/json,charset=utf-8‘}, responseType: ‘arraybuffer‘, //二进制流 } ).then(res => { console.log(res); let blob = new Blob([res], { type: ‘application/vnd.ms-excel,charset=utf-8‘ }); let url =window.URL.createObjectURL(blob); let link = document.createElement(‘a‘); link.download = ‘name.xlsx‘; link.href = url; link.click(); })
原文地址:https://www.cnblogs.com/yaomin/p/10821065.html
时间: 2024-10-31 10:44:21