From 097643665a1202ed00b5e3d41b26d26033f7be5a Mon Sep 17 00:00:00 2001
From: KevinBrother <1301239018@qq.com>
Date: Fri, 19 Aug 2022 09:14:59 +0800
Subject: [PATCH 1/4] Update Pagination.jsx
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
simple 不覆盖会 showTotal 配置选项
---
src/Pagination.jsx | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/Pagination.jsx b/src/Pagination.jsx
index 895b3b44..7221a220 100644
--- a/src/Pagination.jsx
+++ b/src/Pagination.jsx
@@ -425,6 +425,19 @@ class Pagination extends React.Component {
},
{},
);
+
+ let totalText = null;
+
+ if (showTotal) {
+ totalText = (
+
+ {showTotal(total, [
+ total === 0 ? 0 : (current - 1) * pageSize + 1,
+ current * pageSize > total ? total : current * pageSize,
+ ])}
+
+ );
+ }
if (simple) {
if (goButton) {
@@ -467,6 +480,7 @@ class Pagination extends React.Component {
ref={this.savePaginationNode}
{...dataOrAriaAttributeProps}
>
+ {totalText}
- {showTotal(total, [
- total === 0 ? 0 : (current - 1) * pageSize + 1,
- current * pageSize > total ? total : current * pageSize,
- ])}
-
- );
- }
+
const prevDisabled = !this.hasPrev() || !allPages;
const nextDisabled = !this.hasNext() || !allPages;
return (
From 1932b031e1ff59ecf33cd7b259cb9ae3d484146a Mon Sep 17 00:00:00 2001
From: KevinBrother <1301239018@qq.com>
Date: Sun, 21 Aug 2022 17:27:04 +0800
Subject: [PATCH 2/4] Update Pagination.jsx
---
src/Pagination.jsx | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/Pagination.jsx b/src/Pagination.jsx
index 7221a220..7ea49037 100644
--- a/src/Pagination.jsx
+++ b/src/Pagination.jsx
@@ -426,18 +426,14 @@ class Pagination extends React.Component {
{},
);
- let totalText = null;
-
- if (showTotal) {
- totalText = (
-
- {showTotal(total, [
- total === 0 ? 0 : (current - 1) * pageSize + 1,
- current * pageSize > total ? total : current * pageSize,
- ])}
-
- );
- }
+ const totalText = showTotal && (
+
+ {showTotal(total, [
+ total === 0 ? 0 : (current - 1) * pageSize + 1,
+ current * pageSize > total ? total : current * pageSize,
+ ])}
+
+ );
if (simple) {
if (goButton) {
From 80450974d8d38db67c6afdfd438b2e8f62feec17 Mon Sep 17 00:00:00 2001
From: KevinBrother <1301239018@qq.com>
Date: Sun, 21 Aug 2022 17:36:21 +0800
Subject: [PATCH 3/4] Update Pagination.jsx
---
src/Pagination.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pagination.jsx b/src/Pagination.jsx
index 7ea49037..8e67fc08 100644
--- a/src/Pagination.jsx
+++ b/src/Pagination.jsx
@@ -426,7 +426,7 @@ class Pagination extends React.Component {
{},
);
- const totalText = showTotal && (
+ const totalText = showTotal && (
{showTotal(total, [
total === 0 ? 0 : (current - 1) * pageSize + 1,
From 448e5aef56238de62f713594c9caef320d5845a3 Mon Sep 17 00:00:00 2001
From: KevinBrother <1301239018@qq.com>
Date: Sun, 21 Aug 2022 17:49:45 +0800
Subject: [PATCH 4/4] Update simple.jsx
---
docs/examples/simple.jsx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/docs/examples/simple.jsx b/docs/examples/simple.jsx
index a4e6d778..aad3901b 100644
--- a/docs/examples/simple.jsx
+++ b/docs/examples/simple.jsx
@@ -2,4 +2,15 @@ import React from 'react';
import Pagination from 'rc-pagination';
import '../../assets/index.less';
-export default () => ;
+export default () => (
+ <>
+
+
+ `Total ${total} items`}
+ />
+ >
+);