Skip to content

Commit

Permalink
fix(table): fix pagination props working
Browse files Browse the repository at this point in the history
修复table的pagination属性无法动态设置数据的问题
  • Loading branch information
mynetfan committed Jul 27, 2021
1 parent c375e32 commit e327893
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- **BasicTable**
- 修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题
- 修复启用`expandRowByClick`时,点击不可展开的行可能会导致样式错误的问题
- 修复`pagination`属性动态改变不生效的问题
- **Dark Theme** 黑暗主题下的配色问题修正
- 修复`Tree`组件被选中节点的背景颜色
- 修复`Alert`组件的颜色配置
Expand Down
12 changes: 11 additions & 1 deletion src/components/Table/src/hooks/usePagination.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -27,6 +27,16 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
const configRef = ref<PaginationProps>({});
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);

Expand Down

0 comments on commit e327893

Please sign in to comment.