-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Pagination.tsx #551
base: master
Are you sure you want to change the base?
Conversation
外传一个originalPage,解决自定义分页页数下的其他特殊场景问题;
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -214,7 +215,7 @@ const Pagination: React.FC<PaginationProps> = (props) => { | |||
} | |||
|
|||
setCurrent(newPage); | |||
onChange?.(newPage, pageSize); | |||
onChange?.(newPage, pageSize, originalPage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该自己可以存一下上次的page就可以了吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有个场景是最大只加载1-10页,也就是分页只显示1...3.4.5....10 , [加载更多],但是实际上有100页;
点击加载更多变为 1...3.4.5....20;
但是从Input输入框键入的时候,会有个最大页数的判断; 所以如果键入30,但是只能调到20;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所以就想能够获取到Input键入的原始页数;来自行处理这种情况的逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
比如你当前页显示的分页为1....5.6.7....10 ;
我键入了30,这时候我就可以判断total/pagesize是否满足跳转30页的条件;
如果满足 ,我分页显示为 1......18.19.20.....30 并跳转到30;
如果不满足,我就可以调到当前最大页;
外传一个originalPage,解决自定义分页页数下的其他特殊场景问题;