Commit 7faa69b2 authored by 李纪文's avatar 李纪文

fix: 修改表格

parent a716279b
...@@ -46,7 +46,14 @@ const Demo = () => { ...@@ -46,7 +46,14 @@ const Demo = () => {
// @ts-ignore // @ts-ignore
return ( return (
<div style={{ height: '800px' }}> <div style={{ height: '800px' }}>
{!!dataSource.length && <BasicTable dataSource={dataSource} columns={columns} bordered />} {!!dataSource.length && (
<BasicTable
dataSource={dataSource}
columns={columns}
bordered
pagination={{ current: 1, pageSize: 20, size: 'default' }}
/>
)}
{!dataSource.length && <Empty description={'暂无数据'} />} {!dataSource.length && <Empty description={'暂无数据'} />}
</div> </div>
); );
......
...@@ -67,7 +67,13 @@ const Demo = () => { ...@@ -67,7 +67,13 @@ const Demo = () => {
return ( return (
<div style={{ height: '400px' }}> <div style={{ height: '400px' }}>
{!!dataSource.length && ( {!!dataSource.length && (
<BasicTable dataSource={dataSource} columns={columns} bordered summary={Summary} /> <BasicTable
dataSource={dataSource}
columns={columns}
bordered
summary={Summary}
pagination={false}
/>
)} )}
{!dataSource.length && <Empty description={'暂无数据'} />} {!dataSource.length && <Empty description={'暂无数据'} />}
</div> </div>
......
...@@ -7,7 +7,7 @@ import './index.less'; ...@@ -7,7 +7,7 @@ import './index.less';
const BasicTable = (props) => { const BasicTable = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('basic-table'); const prefixCls = getPrefixCls('basic-table');
const pagination = props.pagination || {}; const pagination = typeof props.pagination !== 'undefined' ? props.pagination : {};
const showTotal = (total) => { const showTotal = (total) => {
debugger; debugger;
return `共 ${Math.ceil( return `共 ${Math.ceil(
...@@ -19,7 +19,7 @@ const BasicTable = (props) => { ...@@ -19,7 +19,7 @@ const BasicTable = (props) => {
className={classNames(prefixCls)} className={classNames(prefixCls)}
scroll={{ y: 'calc(100% - 40px)' }} scroll={{ y: 'calc(100% - 40px)' }}
{...props} {...props}
pagination={{ showTotal, ...pagination }} pagination={pagination ? { showTotal, ...pagination } : pagination}
/> />
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment