解法:
//axios
return request({
url: "/saleUnit/exportSaleUnit",
headers: {
"biz-source-param": "BLG"
},
method: "post",
responseType: "blob",
data: params
});
let blob = new Blob([res], { type: "application/x-xls" }); let link = document.createElement("a"); link.href = window.URL.createObjectURL(blob); link.download = `便利购商品列表${this.$dayjs().format( "YYYYMMDDHHmmss" )}.xlsx`; link.click(); this.$message.success("下载成功!");
服务端返回的数据截图
响应头
前端下载脚本
下载的excel
wps打开失败