VUE:axios接收后端文件流并下载文件


that.$axios
        .post(
          that.$Config.downLoad,
          {
            model_file_type: id
          },
          {
            responseType: "blob"
          }
        )
        .then(function(res) {
          let link = document.createElement("a");
          link.href = window.URL.createObjectURL(new Blob([res.data]));
          link.target = "_blank";
//文件名和格式 link.download
= "话术逻辑文件模板.xlsx"; document.body.appendChild(link); link.click(); document.body.removeChild(link); });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM