Skip to content

Commit

Permalink
fix: table pagination not reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Oct 1, 2021
1 parent 1228e1d commit 1add0d2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions components/table/hooks/usePagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default function usePagination(
}

const refreshPagination = (current = 1, pageSize?: number) => {
if (pagination.value === false) return;
setInnerPagination({
current,
pageSize: pageSize || mergedPagination.value.pageSize,
Expand All @@ -93,15 +94,12 @@ export default function usePagination(
onChange(current, pageSize || mergedPagination.value.pageSize);
};

if (pagination.value === false) {
return [computed(() => ({})), () => {}];
}

return [
computed(() => ({
...mergedPagination.value,
onChange: onInternalChange,
})),
computed(() => {
return pagination.value === false
? {}
: { ...mergedPagination.value, onChange: onInternalChange };
}),
refreshPagination,
];
}

0 comments on commit 1add0d2

Please sign in to comment.