Optimize pagination

This commit is contained in:
2023-11-30 10:51:19 +08:00
parent 9a39e05fdf
commit 99d2a73b6c
4 changed files with 24 additions and 4 deletions

View File

@@ -56,7 +56,11 @@ const User: React.FC = () => {
pagination: {
current: 1,
pageSize: 20,
position: ['bottomCenter']
position: ['bottomCenter'],
showTotal: (total, range) =>
`${
range[0] === range[1] ? `${range[0]}` : `${range[0]}~${range[1]}`
} 项 共 ${total}`
}
})
const [tableSelectedItem, setTableSelectedItem] = useState<React.Key[]>([])
@@ -214,6 +218,7 @@ const User: React.FC = () => {
filters: Record<string, _FilterValue | null>,
sorter: _SorterResult<UserWithRoleInfoVo> | _SorterResult<UserWithRoleInfoVo>[]
) => {
pagination = { ...tableParams.pagination, ...pagination }
if (Array.isArray(sorter)) {
setTableParams({
pagination,