feat(web): table support pagesize
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-02 15:29:46
|
* @Date: 2026-02-02 15:29:46
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-26 14:52:23
|
* @Last Modified time: 2026-04-14 17:55:15
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* RbTable Component
|
* RbTable Component
|
||||||
@@ -27,7 +27,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { request } from '@/utils/request';
|
import { request } from '@/utils/request';
|
||||||
import Empty from '@/components/Empty';
|
import Empty from '@/components/Empty';
|
||||||
|
|
||||||
interface TablePaginationConfig { pagesize: number; page: number; }
|
interface TablePaginationConfig { pagesize?: number; page?: number; }
|
||||||
|
|
||||||
/** Props interface for Table component */
|
/** Props interface for Table component */
|
||||||
interface TableComponentProps<T = Record<string, unknown>, Q = Record<string, unknown>> extends Omit<TableProps<T>, 'pagination'> {
|
interface TableComponentProps<T = Record<string, unknown>, Q = Record<string, unknown>> extends Omit<TableProps<T>, 'pagination'> {
|
||||||
@@ -102,7 +102,7 @@ const RbTable = forwardRef(<T = Record<string, unknown>, Q = Record<string, unkn
|
|||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [currentPagination, setCurrentPagination] = useState({
|
const [currentPagination, setCurrentPagination] = useState({
|
||||||
page: 1,
|
page: 1,
|
||||||
pagesize: 20,
|
pagesize: typeof pagination === 'object' ? (pagination.pagesize || 20) : 20,
|
||||||
});
|
});
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ const Index = () => {
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
bordered={false}
|
bordered={false}
|
||||||
scrollY="100%"
|
scrollY="100%"
|
||||||
|
pagination={{pagesize: 10}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
Reference in New Issue
Block a user