问题 :下载的文件是乱码
createDownloadFile(res) { var blob = new Blob([res],{ type: 'application/vnd.ms-excel' }); var link = document.createElement('a') link.download = "file"; link.href = URL.createObjectURL(blob); document.body.appendChild(link) link.click() document.body.removeChild(link) },
解决方式:请求添加responseType: "arraybuffer",
export const questionnaireDownload = data =>http({responseType: "arraybuffer",data,url: '/questionnaire/download'})