download = (id,filename) => {

fetch(`http://127.0.0.1:8111/v1/downloadtask/${id}`, {

method: "GET",

headers: {

"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

      },

responseType: "blob"

    }).then((response) => {

response.blob().then(blob => {

const blobUrl = window.URL.createObjectURL(blob);

const a = document.createElement('a');

a.href = blobUrl;

a.download = `${filename}.xlsx` ;

a.click();

window.URL.revokeObjectURL(blobUrl);

      });

    }).catch((error) => {

console.log(error);

    });

  };

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2021-04-17
  • 2021-05-16
  • 2021-10-01
相关资源
相似解决方案