Skip to content

Commit

Permalink
Merge pull request #1045 from yzl-fork-repo/fix-typo
Browse files Browse the repository at this point in the history
fix(typo): fix typo in usePaginated.ts
  • Loading branch information
brickspert committed Jul 20, 2021
2 parents cea4486 + a23b6bd commit abfce57
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/use-request/src/usePaginated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ function usePaginated<R, Item, U extends Item = any>(
...(restOptions as any),
});

const { current = 1, pageSize = defaultPageSize, sorter = {}, filters = {} } =
params && params[0] ? params[0] : ({} as any);
const {
current = 1,
pageSize = defaultPageSize,
sorter = {},
filters = {},
} = params && params[0] ? params[0] : ({} as any);

// 只改变 pagination,其他参数原样传递
const runChangePaination = useCallback(
const runChangePagination = useCallback(
(paginationParams: any) => {
const [oldPaginationParams, ...restParams] = params;
run(
Expand All @@ -70,12 +74,12 @@ function usePaginated<R, Item, U extends Item = any>(
if (toCurrent > tempTotalPage) {
toCurrent = tempTotalPage;
}
runChangePaination({
runChangePagination({
current: c,
pageSize: p,
});
},
[total, runChangePaination],
[total, runChangePagination],
);

const changeCurrent = useCallback(
Expand Down Expand Up @@ -105,14 +109,14 @@ function usePaginated<R, Item, U extends Item = any>(
// 表格翻页 排序 筛选等
const changeTable = useCallback(
(p: PaginationConfig, f?: Filter, s?: Sorter) => {
runChangePaination({
runChangePagination({
current: p.current,
pageSize: p.pageSize || defaultPageSize,
filters: f,
sorter: s,
});
},
[filters, sorter, runChangePaination],
[filters, sorter, runChangePagination],
);

return {
Expand Down

0 comments on commit abfce57

Please sign in to comment.