📜  内容处置附件 javascript fetch 下载“excel” - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:23.653000             🧑  作者: Mango

代码示例1
download(filename) {
 fetch(url , { headers })
 .then(response => response.blob())
 .then(blob => URL.createObjectURL(blob))
 .then(uril => {
 var link = document.createElement("a");
 link.href = uril;
 link.download = filename + ".csv";
 document.body.appendChild(link);
 link.click();
 document.body.removeChild(link);
 });
}