index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React from 'react';
  2. import { Table } from 'antd';
  3. export default function DetialTable(props) {
  4. const {
  5. columns,
  6. data = [],
  7. rowKey= 'id',
  8. size = 'default',
  9. scroll,
  10. onChange,
  11. total = 0,
  12. curIndex,
  13. pageSize = 15,
  14. pagination = true,
  15. expandedRowRender = false,
  16. onExpand = false,
  17. ellipsis = false,
  18. rowClassName,
  19. onHeaderRow
  20. } = props
  21. return (
  22. <div>
  23. <Table
  24. className="detialTable"
  25. size={size}
  26. columns={columns}
  27. dataSource={data}
  28. rowKey={rowKey}
  29. rowClassName={rowClassName}
  30. onHeaderRow={onHeaderRow}
  31. pagination= {pagination && {
  32. size: "default",
  33. showQuickJumper: true,
  34. current: curIndex,
  35. // showSizeChanger: true,
  36. pageSize,
  37. total,
  38. showTotal: total => `共 ${total} 条`
  39. }}
  40. ellipsis={ellipsis}
  41. scroll={scroll}
  42. onExpand={onExpand}
  43. expandedRowRender={expandedRowRender}
  44. onChange={(pagination, filters, sorter, extra) => onChange(pagination, filters, sorter, extra)}
  45. />
  46. </div>
  47. );
  48. }