2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
2016-09-21 11:28:38 +08:00
|
|
|
|
subtitle: 分页
|
2016-05-11 14:21:01 +08:00
|
|
|
|
type: Navigation
|
2016-09-21 11:28:38 +08:00
|
|
|
|
title: Pagination
|
2017-02-18 18:12:38 +08:00
|
|
|
|
cols: 1
|
2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
2015-06-15 22:01:39 +08:00
|
|
|
|
|
2015-06-26 14:42:30 +08:00
|
|
|
|
采用分页的形式分隔长列表,每次只加载一个页面。
|
2015-06-15 22:01:39 +08:00
|
|
|
|
|
2015-06-26 14:42:30 +08:00
|
|
|
|
## 何时使用
|
2015-06-17 20:24:42 +08:00
|
|
|
|
|
2015-06-26 14:42:30 +08:00
|
|
|
|
- 当加载/渲染所有数据将花费很多时间时;
|
|
|
|
|
- 可切换页码浏览数据。
|
2015-07-13 17:51:28 +08:00
|
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
2015-09-23 14:13:31 +08:00
|
|
|
|
```html
|
|
|
|
|
<Pagination onChange={onChange} total={50} />
|
|
|
|
|
```
|
2015-07-13 17:51:28 +08:00
|
|
|
|
|
2017-10-25 10:25:44 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| current | 当前页数 | number | - |
|
|
|
|
|
| defaultCurrent | 默认的当前页数 | number | 1 |
|
|
|
|
|
| defaultPageSize | 默认的每页条数 | number | 10 |
|
|
|
|
|
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
|
|
|
|
|
| pageSize | 每页条数 | number | - |
|
|
|
|
|
| pageSizeOptions | 指定每页可以显示多少条 | string\[] | ['10', '20', '30', '40'] |
|
|
|
|
|
| showQuickJumper | 是否可以快速跳转至某页 | boolean | false |
|
|
|
|
|
| showSizeChanger | 是否可以改变 pageSize | boolean | false |
|
|
|
|
|
| showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - |
|
|
|
|
|
| simple | 当添加该属性时,显示为简单分页 | boolean | - |
|
|
|
|
|
| size | 当为「small」时,是小尺寸分页 | string | "" |
|
|
|
|
|
| total | 数据总数 | number | 0 |
|
|
|
|
|
| onChange | 页码改变的回调,参数是改变后的页码及每页条数 | Function(page, pageSize) | noop |
|
|
|
|
|
| onShowSizeChange | pageSize 变化的回调 | Function(current, size) | noop |
|