function toFile(res, name){
if(!res || !(res instanceof Blob))return;
const link = document.createElement('a')
let blob = new Blob([res],{type: 'application/vnd.ms-excel;charset=UTF-8'});
link.style.display = 'none'
link.href = window.URL.createObjectURL(blob);
link.setAttribute('download', name);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(blob);
}
后端返回二进制流数据前端转xls文件
最新推荐文章于 2024-05-06 21:14:36 发布