前端导出文件流

axios({
         method:"post",
          url: `${this.$configServer.API_URL}portal/carMainBoard/export`,
          data,
          headers,
          responseType: "blob",
          exportFlag:true
        }).then(res => {
          if(res.status !== 200) return this.$message.error("文件下载失败")
          const blob = new Blob([res.data]);
          const link = document.createElement("a");
          link.href =  URL.createObjectURL(blob);
          link.download = `${this.setRiskTypeName()}.xlsx`;
          document.body.appendChild(link);
          link.click();
          document.body.removeChild(link);
        })

你可能感兴趣的:(前端导出文件流)