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

@@ -36,7 +36,11 @@ const Role: 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 [searchName, setSearchName] = useState('')
@@ -130,6 +134,7 @@ const Role: React.FC = () => {
filters: Record<string, _FilterValue | null>,
sorter: _SorterResult<RoleWithPowerGetVo> | _SorterResult<RoleWithPowerGetVo>[]
) => {
pagination = { ...tableParams.pagination, ...pagination }
if (Array.isArray(sorter)) {
setTableParams({
pagination,