美文网首页
前端导出文件流

前端导出文件流

作者: 是嘻嘻呀 | 来源:发表于2020-11-13 16:17 被阅读0次
    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);
            })
    

    相关文章

      网友评论

          本文标题:前端导出文件流

          本文链接:https://www.haomeiwen.com/subject/poxbbktx.html