-
Notifications
You must be signed in to change notification settings - Fork 3
/
PageTable.view.tsx
16 lines (14 loc) · 936 Bytes
/
PageTable.view.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import React from 'react';
import { Table } from 'antd';
import usePageTableHook from './PageTable.hook';
import { PageTableProps } from './PageTable';
import './PageTable.less';
export const PageTable = (props: { options: PageTableProps<any>, loading: boolean }) => {
const { onTableChange, columns } = usePageTableHook(props.options);
return (
<div className="page-table">
<Table rowKey="id" size="small" tableLayout={props.options.tableLayout} columns={columns} pagination={props.options.pagination ? { current: props.options.pagination.current, pageSize: props.options.pagination.pageSize, total: props.options.pagination.total, showTotal: (total) => `共${total}条`, showSizeChanger: true, pageSizeOptions: ['10', '20', '50', '100'] } : {}} dataSource={props.options.dataSource} loading={props.loading} onChange={onTableChange} scroll={{ y: 'calc(100vh - 346px)' }} />
</div>
);
};
export default PageTable;