Commit e32789373eb5b1b531572b59692bf552dac365dc

Authored by 无木
1 parent c375e323

fix(table): fix `pagination` props working

修复table的pagination属性无法动态设置数据的问题
CHANGELOG.zh_CN.md
... ... @@ -11,6 +11,7 @@
11 11 - **BasicTable**
12 12 - 修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题
13 13 - 修复启用`expandRowByClick`时,点击不可展开的行可能会导致样式错误的问题
  14 + - 修复`pagination`属性动态改变不生效的问题
14 15 - **Dark Theme** 黑暗主题下的配色问题修正
15 16 - 修复`Tree`组件被选中节点的背景颜色
16 17 - 修复`Alert`组件的颜色配置
... ...
src/components/Table/src/hooks/usePagination.tsx
1 1 import type { PaginationProps } from '../types/pagination';
2 2 import type { BasicTableProps } from '../types/table';
3   -import { computed, unref, ref, ComputedRef } from 'vue';
  3 +import { computed, unref, ref, ComputedRef, watchEffect } from 'vue';
4 4 import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
5 5 import { isBoolean } from '/@/utils/is';
6 6 import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../const';
... ... @@ -27,6 +27,16 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
27 27 const configRef = ref<PaginationProps>({});
28 28 const show = ref(true);
29 29  
  30 + watchEffect(() => {
  31 + const { pagination } = unref(refProps);
  32 + if (!isBoolean(pagination) && pagination) {
  33 + configRef.value = {
  34 + ...unref(configRef),
  35 + ...(pagination ?? {}),
  36 + };
  37 + }
  38 + });
  39 +
30 40 const getPaginationInfo = computed((): PaginationProps | boolean => {
31 41 const { pagination } = unref(refProps);
32 42  
... ...