2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 9
|
2016-07-29 10:15:31 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 总数
|
|
|
|
en-US: Total number
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-02-25 10:36:58 +08:00
|
|
|
|
2016-07-29 10:15:31 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-02-25 10:36:58 +08:00
|
|
|
通过设置 `showTotal` 展示总共有多少数据。
|
|
|
|
|
2016-07-29 10:15:31 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
You can show the total number of data by setting `showTotal`.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2016-11-22 10:12:14 +08:00
|
|
|
import { Pagination } from 'antd';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2016-02-25 10:36:58 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-07-07 21:33:07 +08:00
|
|
|
<>
|
2017-02-23 11:45:48 +08:00
|
|
|
<Pagination
|
|
|
|
total={85}
|
|
|
|
showTotal={total => `Total ${total} items`}
|
2020-06-28 15:16:23 +08:00
|
|
|
defaultPageSize={20}
|
2017-02-23 11:45:48 +08:00
|
|
|
defaultCurrent={1}
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
<Pagination
|
|
|
|
total={85}
|
|
|
|
showTotal={(total, range) => `${range[0]}-${range[1]} of ${total} items`}
|
2020-06-28 15:16:23 +08:00
|
|
|
defaultPageSize={20}
|
2017-02-23 11:45:48 +08:00
|
|
|
defaultCurrent={1}
|
|
|
|
/>
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|