0.0.2 • Published 6 years ago

igroot-export-excel v0.0.2

Weekly downloads
8
License
MIT
Repository
-
Last release
6 years ago

导出 Excel 数据组件

何时使用

需要导出 excel 数据到表格中,导出的数据是个二维数组,同时希望定义导出的二维数据的表头。

安装方法(请修改您的业务组件的安装方法)

  sl add -c igroot-export-excel

API

<IgrootExportExcel 
  fileName="文件名"
  sheetName="表名"
  columns={columns}
  dataSource={dataSource}
>
  <Button> 导出数据 </Button>
</IgrootExportExcel>

属性

参数说明类型默认值
style样式Object-
className扩展样式类名string-
autoPreview是否预览booleanfalse
columns导出的表头设置array-
dataSource导出的数据array-
onImportSuccess导入成功的回调函数function-

style: PropTypes.object, className: PropTypes.string, autoPreview: PropTypes.bool, fileName: PropTypes.string, sheetName: PropTypes.string, columns: PropTypes.array, dataSource: PropTypes.array

columns

const columns = [{
  title: '姓名',
  dataIndex: 'name',
  key: 'name',
}, {
  title: '年龄',
  dataIndex: 'age',
  key: 'age',
}, {
  title: '住址',
  dataIndex: 'address',
  key: 'address',
}]