Skip to content

Commit

Permalink
fix: improve jump page (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaodahong authored and afc163 committed Sep 30, 2019
1 parent 0e4abf8 commit d96d440
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class Pagination extends React.Component {
}

isValid = (page) => {
return isInteger(page) && page >= 1 && page !== this.state.current;
return isInteger(page) && page !== this.state.current;
}

shouldDisplayQuickJumper = () => {
Expand Down Expand Up @@ -258,6 +258,8 @@ class Pagination extends React.Component {
const currentPage = calculatePage(undefined, this.state, this.props);
if (page > currentPage) {
page = currentPage;
} else if (page < 1) {
page = 1;
}

if (!('current' in this.props)) {
Expand Down

3 comments on commit d96d440

@vercel
Copy link

@vercel vercel bot commented on d96d440 Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cyonet
Copy link

@Cyonet Cyonet commented on d96d440 Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个有个BUG
isValid = (page) => { return isInteger(page) && page !== this.state.current; }
在Options.jsx文件中
getValidValue() { const { goInputText, current } = this.state; return isNaN(goInputText) ? current : Number(goInputText); }
对输入值做了Number转换造成input失去焦点后为0,重置到首页

@silviawxy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样改了之后,当size为0,pager为0,disabled仍然可以触发onchange

Please sign in to comment.