vue下载文件流

//接口请求
getDownXlsx({ type: 'certificatemicroabilityME' }).then(res => {
      //创建a标签(下载)
      let a = document.createElement('a');
      //ArrayBuffer 转为 Blob
      let blob = new Blob([res.data], { type: "application/vnd.ms-excel" });
      let objectUrl = URL.createObjectURL(blob);
      a.setAttribute("href", objectUrl);
      a.setAttribute("download", '模板.xls');
      a.click();
})

你可能感兴趣的:(vue下载文件流)