zent
Version:
一套前端设计语言和基于React的实现
25 lines (22 loc) • 558 B
text/typescript
import { PaginationLayout } from './type';
import { IPaginationLayoutOptions } from '../impl/BasePagination';
export default function miniLayout(
options: IPaginationLayoutOptions
): PaginationLayout[] {
const { current, pageSize, total } = options;
const totalPages = Math.ceil(total / pageSize);
return [
{
type: 'left-arrow',
disabled: current <= 1 || total <= 0,
},
{
type: 'mini-jumper',
totalPages,
},
{
type: 'right-arrow',
disabled: current >= totalPages || total <= 0,
},
];
}