Skip to content

Commit 531bac6

Browse files
committed
refactor render code
1 parent fec4d62 commit 531bac6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Pagination.jsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,18 +325,21 @@ class Pagination extends React.Component {
325325
}
326326

327327
render() {
328-
const { prefixCls, className, disabled } = this.props;
328+
const {
329+
prefixCls,
330+
className,
331+
disabled,
332+
hideOnSinglePage,
333+
total,
334+
locale,
335+
} = this.props;
329336

330337
// When hideOnSinglePage is true and there is only 1 page, hide the pager
331-
if (
332-
this.props.hideOnSinglePage === true &&
333-
this.props.total <= this.state.pageSize
334-
) {
338+
if (hideOnSinglePage === true && total <= this.state.pageSize) {
335339
return null;
336340
}
337341

338342
const { props } = this;
339-
const { locale } = props;
340343

341344
const allPages = calculatePage(undefined, this.state, this.props);
342345
const pagerList = [];

0 commit comments

Comments
 (0)