Skip to content

Commit

Permalink
fix: 修复分页逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
lhbxs committed Sep 22, 2023
1 parent 98d1e51 commit f701c87
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/table-render/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,19 @@ const useTableRoot = props => {
.then(res => {
// TODO:这里校验res是否规范
const { rows, total, pageSize, ...extraData } = res;
const newPagination = {
..._pagination,
total,
pageSize: pageSize || _pageSize,
};

set({
loading: false,
dataSource: rows,
...extraData,
pagination: {
..._pagination,
total,
pageSize: pageSize || _pageSize,
},
pagination: newPagination,
});
paginationRef.current = newPagination;
afterSearch.current({ rows, total, pageSize, ...extraData });
})
.catch(err => {
Expand All @@ -101,8 +104,9 @@ const useTableRoot = props => {
params?: { tab?: string | number; stay?: boolean },
moreSearch?: any
) => {
const _stay = (params && params.stay) || false;
const _stay = params?.stay || false;
const _search = moreSearch || {};

doSearch(
{
current: _stay ? paginationRef?.current?.current : 1,
Expand Down

0 comments on commit f701c87

Please sign in to comment.