export function exportUserinfoList(data) {
return request.postJson(urls.exportUserinfoList, data, {
responseType: "arraybuffer"
}).then((res) => {
console.log(res);
var blob = new Blob([res], {
type: 'application/msword;charset=utf-8'
});
var reader = new FileReader();
reader.readAsDataURL(blob); // 转换为base64,可以直接放入a标签的href里
let date = new Date().getTime();
reader.onload = function (e) {
var a = document.createElement('a');
a.download = `会员信息-${date}.xlsx`;
a.href = e.target.result;
document.body.append(a); // 修复firefox中无法触发click
a.click();
a.remove();
}
}).catch(error => {
console.log(error)
})
}
vue根据后台数据导出execl
最新推荐文章于 2022-12-02 13:38:30 发布