问题遇到的现象和发生背景
下载表格后文件损坏打不开
问题相关代码,请勿粘贴截图
this.$_axios({
method: "POST",
url:'/api/distribution/currentSituationMap/export/deviceData',
responseType: "blob",
data:fromdate,
headers: {
"Content-Type": "application/json;charset=UTF-8",
},
}).then((res) => {
const blob = new Blob([res], { type: 'application/xlsx' });
const aElement = document.createElement('a');
const blobUrl = window.URL.createObjectURL(blob);
const filename = `${222}.xlsx`;
aElement.href = blobUrl;
aElement.download = filename;
aElement.click();
window.URL.revokeObjectURL(blobUrl);
})
运行结果及报错内容
这是后端返回内容