vue:write-excel-file页面文字转为xlsx文件

需求:导出弹框内容全部数据,通常这种前端拿到全部数据的情况下做出的导出,无需跟分页列表一样向接口发起请求

实现:点击跳转github了解write-excel-file 

下面说说vue3+ts项目中引入write-excel-file

1-安装引入

npm install write-excel-file --save

2-引入并使用

更多导出列表文件配置参考 write-excel-file

<!-- 北斗卡详情 -->
<script setup lang="ts">
//引入!
import writeXlsxFile from 'write-excel-file';

// 是否正在导出
const isExporting = ref(false);
// 点击导出按钮
const onClickExport = useThrottleFn(async () => {
  isExporting.value = true;
  let schema = [
    {column: 'test1', type: String, value: v => v.platformName, width: 20},
    {column: 'test2', type: String, value: v => v.cardNo, width: 20},
    {column: 'test3', type: String, value: v => v.clientAccount, width: 20}
  ];
  // 具体使用——导出文件 简单配置!
  await writeXlsxFile(cardList.value, {
    schema,
    headerStyle: {
      backgroundColor: '#FAFAFA',
      fontWeight: 'bold'
    },
    fileName: '导出.xlsx'
  });
  isExporting.value = false;
});
</script>

相关推荐

  1. vue:write-excel-file页面文字转为xlsx文件

    2024-04-20 16:42:08       36 阅读
  2. Anylogic中Excel 文件Excel file)的使用

    2024-04-20 16:42:08       18 阅读
  3. EXCEL自动化08】将xls文件批量另存为xlsx文件

    2024-04-20 16:42:08       66 阅读
  4. file 文件

    2024-04-20 16:42:08       40 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-20 16:42:08       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-20 16:42:08       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-20 16:42:08       87 阅读
  4. Python语言-面向对象

    2024-04-20 16:42:08       97 阅读

热门阅读

  1. Cesium之home键开关及相机位置设置

    2024-04-20 16:42:08       34 阅读
  2. PostCSS概述

    2024-04-20 16:42:08       32 阅读
  3. docker初识

    2024-04-20 16:42:08       25 阅读
  4. Linux命令学习—FTP 服务器

    2024-04-20 16:42:08       32 阅读
  5. 从写博客到现在的感受

    2024-04-20 16:42:08       30 阅读
  6. 220个常见的金融术语名词解释

    2024-04-20 16:42:08       28 阅读
  7. CentOS常用的命令

    2024-04-20 16:42:08       49 阅读