1. import XLSX from 'xlsx' import ES6Promise from 'es6-promise' 2.入参增加 responseType: 'blob', 例如: exportTemporaryList: params => { return api.get({url: '/temporary/exportTemporaryList', params, responseType: 'blob', headers: {'Content-Type': 'application/json'}}) }, 3. organApi.exportTemporaryList(dataInformation) // 重新获取下级节点 .then((res2) => { let downloadFileName = 'aaaa.xlsx' // 导出后文件名 if ('msSaveOrOpenBlob' in navigator) { // Microsoft Edge and Microsoft Internet Explorer 10-11 window.navigator.msSaveOrOpenBlob(res2, downloadFileName) } else { // standard code for Google Chrome, Mozilla Firefox etc var blob = new Blob([res2], {type: 'application/vnd.ms-excel'}) var downloadElement = document.createElement('a') var href = window.URL.createObjectURL(blob) // 创建导出的链接 downloadElement.href = href downloadElement.download = downloadFileName document.body.appendChild(downloadElement) downloadElement.click() // 点击导出 setTimeout(() => { document.body.removeChild(downloadElement) // 导出完成移除元素 window.URL.revokeObjectURL(href) // 释放掉blob对象 }, 500) } })