Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

DroganC
Copy link

@DroganC DroganC commented Dec 18, 2023

外传一个originalPage,解决自定义分页页数下的其他特殊场景问题;

外传一个originalPage,解决自定义分页页数下的其他特殊场景问题;
Copy link

vercel bot commented Dec 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pagination ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2023 9:13am

@@ -214,7 +215,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
}

setCurrent(newPage);
onChange?.(newPage, pageSize);
onChange?.(newPage, pageSize, originalPage);
Copy link
Member

Choose a reason for hiding this comment

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

应该自己可以存一下上次的page就可以了吧

Copy link
Author

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;

Copy link
Author

Choose a reason for hiding this comment

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

所以就想能够获取到Input键入的原始页数;来自行处理这种情况的逻辑

Copy link
Author

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;
如果不满足,我就可以调到当前最大页;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants