function downloadFile(url, fileName) { axios({ method: 'get', url: url, // data: encryptList.Encrypt(JSON.stringify(params)), // data: params, responseType: 'blob', // headers: { // 'token': tool.getToken(), // appId: 36, // 'Content-Type': 'application/x-www-form-urlencoded' // } }).then(res => { const link = document.createElement('a') const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) link.style.display = 'none' link.href = URL.createObjectURL(blob) link.setAttribute('download', `${fileName}`) document.body.appendChild(link) link.click() document.body.removeChild(link); }).catch(err => { console.log('导出报错', err); }); }