mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-22 02:06:38 +08:00
优化一些交互逻辑
This commit is contained in:
parent
73adc31284
commit
8551e07c70
@ -265,6 +265,15 @@ const UsersTable = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlePageChange = page => {
|
||||||
|
setActivePage(page);
|
||||||
|
if (page === Math.ceil(users.length / ITEMS_PER_PAGE) + 1) {
|
||||||
|
// In this case we have to load more data and then append them.
|
||||||
|
loadUsers(page - 1).then(r => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const pageData = users.slice((activePage - 1) * ITEMS_PER_PAGE, activePage * ITEMS_PER_PAGE);
|
const pageData = users.slice((activePage - 1) * ITEMS_PER_PAGE, activePage * ITEMS_PER_PAGE);
|
||||||
|
|
||||||
const closeAddUser = () => {
|
const closeAddUser = () => {
|
||||||
@ -303,7 +312,8 @@ const UsersTable = () => {
|
|||||||
currentPage: activePage,
|
currentPage: activePage,
|
||||||
pageSize: ITEMS_PER_PAGE,
|
pageSize: ITEMS_PER_PAGE,
|
||||||
total: userCount,
|
total: userCount,
|
||||||
pageSizeOpts: [10, 20, 50, 100], // onPageChange: handlePageChange,
|
pageSizeOpts: [10, 20, 50, 100],
|
||||||
|
onPageChange: handlePageChange,
|
||||||
}} loading={loading}/>
|
}} loading={loading}/>
|
||||||
<Button theme='light' type='primary' style={{marginRight: 8}} onClick={
|
<Button theme='light' type='primary' style={{marginRight: 8}} onClick={
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user