vue 处理后端返回的文档流
xiazai(){ this.$_api.kanbanApi .Get({ responseType: 'blob', url: 'KanbanItemData/exportExcel' //`${this.selectComponents.config.dataUrl}/exportExcel` }).then(res=>{ console.log(res,'下载模板'); }).catch(err=>{ console.log(err,'err'); //响应封装问题 正常应该在then中 const url = window.URL.createObjectURL(new Blob([err],{type:"application/vnd.ms-excel;charset=utf-8"})); const link = document.createElement('a'); link.href = url; let fileName = '下载'+".xlsx"; link.setAttribute('download', fileName); document.body.appendChild(link); link.click(); }) },