下载xslx二进制文件

申请头必须config.headers["Content-Type"] = "application/json";
设置responseType为blob或arraybuffer

// 下载文件export const downloadFile = ({ obj, name = "", suffix = "xlsx" }) => {  const url = window.URL.createObjectURL(new Blob([obj]));  const link = document.createElement("a");  link.style.display = "none";  link.href = url;  const fileName = new Date() + "-" + name + "." + suffix;  link.setAttribute("download", fileName);  document.body.appendChild(link);  link.click();  document.body.removeChild(link);};
this.$api["EXPORT_LOGLIST"]({        ...data,        includes: ["index", "@timestamp", "message", ...this.selectedField],        excludes: [],      }).then((res) => {        downloadFile({ obj: res });      });
//导出日志  EXPORT_LOGLIST(data) {    return request({      url: "/search/conditionSearch/export",      responseType: "blob",      method: "post",      data,    });  },