axios({
    url: `url`,
    method: "post",
    data: {
     参数...
    },
    responseType: "blob",
  })
.then((res)=>{
    const elink = document.createElement("a");
      const fileName = `${data.name}.pdf`;
      elink.target = "hrefTemplate";
      elink.download = fileName;
      elink.href = URL.createObjectURL(blob);
      elink.click();
      URL.revokeObjectURL(elink.href); // 释放URL 对象
})
 posted on 2025-02-18 16:08  久闻  阅读(24)  评论(0)    收藏  举报