diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 7f3245dabbc..56a72806856 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -11,6 +11,7 @@ - **BasicTable** - 修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题 - 修复启用`expandRowByClick`时,点击不可展开的行可能会导致样式错误的问题 + - 修复`pagination`属性动态改变不生效的问题 - **Dark Theme** 黑暗主题下的配色问题修正 - 修复`Tree`组件被选中节点的背景颜色 - 修复`Alert`组件的颜色配置 diff --git a/src/components/Table/src/hooks/usePagination.tsx b/src/components/Table/src/hooks/usePagination.tsx index 760f899bf0f..4fb2362fe36 100644 --- a/src/components/Table/src/hooks/usePagination.tsx +++ b/src/components/Table/src/hooks/usePagination.tsx @@ -1,6 +1,6 @@ import type { PaginationProps } from '../types/pagination'; import type { BasicTableProps } from '../types/table'; -import { computed, unref, ref, ComputedRef } from 'vue'; +import { computed, unref, ref, ComputedRef, watchEffect } from 'vue'; import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue'; import { isBoolean } from '/@/utils/is'; import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../const'; @@ -27,6 +27,16 @@ export function usePagination(refProps: ComputedRef) { const configRef = ref({}); const show = ref(true); + watchEffect(() => { + const { pagination } = unref(refProps); + if (!isBoolean(pagination) && pagination) { + configRef.value = { + ...unref(configRef), + ...(pagination ?? {}), + }; + } + }); + const getPaginationInfo = computed((): PaginationProps | boolean => { const { pagination } = unref(refProps);