From 1add0d251cd35aa2c55404f7a60f1531425490c1 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 1 Oct 2021 16:13:24 +0800 Subject: [PATCH] fix: table pagination not reactive --- components/table/hooks/usePagination.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/components/table/hooks/usePagination.ts b/components/table/hooks/usePagination.ts index 5772a04b6..a0710b148 100644 --- a/components/table/hooks/usePagination.ts +++ b/components/table/hooks/usePagination.ts @@ -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, @@ -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, ]; }