web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

js后端返回的数据是blob类型的excel下载文件

431 ℃
     

注:ajax中加responseType: "blob"

if (res && res.status === 200) {
  const filename = "对账表.xlsx";
  const blob = new Blob([res.data]);
  const link = document.createElement("a");
  link.style.display = "none";
  link.href = URL.createObjectURL(blob);
  link.setAttribute("download", filename);
  document.documentElement.appendChild(link);
  link.click();
  document.documentElement.removeChild(link);
} else {
  let content = res.data; //arraybuffer类型数据
  let resBlob = new Blob([content]);
  let reader = new FileReader();
  reader.readAsText(resBlob, "utf-8");
  reader.onload = () => {
	_this.$message.error(reader.result);
  };
}

excel拆分单元格快捷键怎么用

如何利用PHPExcel类库建php将数据格式转为excel

vuejs导入excel(多个Sheet表全部解析)

vuejs前端做一个点击按钮下载excel文件模板功能

vuejs导入excel表格解析成JSON数据(日期变成数字)解决方法

标签: blob, excel, 下载

上面是“js后端返回的数据是blob类型的excel下载文件”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_2048.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > js
本文共计538个字,预计阅读时长4分钟
生活小工具,收录了80多款小工具
上一篇: 抖音联合方正打造免费可商用品牌字体——抖音美好体
下一篇: 推荐一个在线图文转视频、AI 数字人工具——一帧秒创(免费赠送100分钟)
x 打工人ai神器