lay-excel

未匹配的标注

LAY-EXCEL 简单快捷的导出插件

安装后弄个 Botton 嵌入页面就可以了。

import { ExportOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import { useState } from 'react';
import LAY_EXCEL from 'lay-excel';

type Props = {
  data: [];
  title: string;
  loading: boolean;
};
function ButtonExportExcel(props: Props) {
  const [loading, setLoading] = useState(props.loading);
  async function onClick() {
    setLoading(true);
    LAY_EXCEL.exportExcel(props.data, `${props.title}.xlsx`, 'xlsx')
    setLoading(false);
  }
  return (
    <Button type="primary" loading={props.loading && loading} size={'small'} icon={<ExportOutlined />} onClick={onClick}>导出Excel</Button>
  );
}
export default ButtonExportExcel;

本文章首发在 LearnKu.com 网站上。

上一篇 下一篇
秦晓武
讨论数量: 0
发起讨论 只看当前版本


暂无话题~