From cdbac65dbcdf66a98b6ed342509402e7d5ffb788 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 25 Feb 2016 10:36:58 +0800 Subject: [PATCH] feat: add `showTotal` for Pagination --- components/pagination/demo/mini.md | 6 ++++++ components/pagination/demo/total.md | 24 ++++++++++++++++++++++++ components/pagination/index.md | 1 + style/components/pagination.less | 11 +++++++++++ 4 files changed, 42 insertions(+) create mode 100644 components/pagination/demo/total.md diff --git a/components/pagination/demo/mini.md b/components/pagination/demo/mini.md index 91c290d1ab..a92aca9c39 100644 --- a/components/pagination/demo/mini.md +++ b/components/pagination/demo/mini.md @@ -9,9 +9,15 @@ ````jsx import { Pagination } from 'antd'; +function showTotal(total) { + return `共 ${total} 条`; +} + ReactDOM.render(

+
+
, mountNode); ```` diff --git a/components/pagination/demo/total.md b/components/pagination/demo/total.md new file mode 100644 index 0000000000..f773e91cc0 --- /dev/null +++ b/components/pagination/demo/total.md @@ -0,0 +1,24 @@ +# 总数 + +- order: 9 + +通过设置 `showTotal` 展示总共有多少数据。 + +--- + +````jsx +import { Pagination, Select } from 'antd'; + +function showTotal(total) { + return `共 ${total} 条`; +} + +ReactDOM.render( + , + mountNode +); +```` diff --git a/components/pagination/index.md b/components/pagination/index.md index b9acffad65..5374736a2b 100644 --- a/components/pagination/index.md +++ b/components/pagination/index.md @@ -32,3 +32,4 @@ | showQuickJumper | 是否可以快速跳转至某页 | Bool | false | | size | 当为「small」时,是小尺寸分页 | String | "" | | simple | 当添加该属性时,显示为简单分页 | Object | 无 | +| showTotal | 用于显示总共有多少条数据 | Function | 无 | diff --git a/style/components/pagination.less b/style/components/pagination.less index 2eddb5cf04..25a4b8d466 100644 --- a/style/components/pagination.less +++ b/style/components/pagination.less @@ -13,6 +13,13 @@ visibility: hidden; } + &-total-text { + float: left; + height: 30px; + line-height: 30px; + margin-right: 10px; + } + &-item { cursor: pointer; border-radius: @border-radius-base; @@ -232,6 +239,10 @@ } .@{pagination-prefix-cls} { + &.mini &-total-text { + height: 20px; + line-height: 20px; + } &.mini &-item { border: 0;