From d81481c52186145dac130aaa1594f0ba8db4d392 Mon Sep 17 00:00:00 2001 From: Vben Date: Sun, 6 Jun 2021 22:54:25 +0800 Subject: [PATCH] fix(table): try to get close to the form stuck --- src/components/Table/src/hooks/useTable.ts | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index 740420a5..58b30502 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -2,10 +2,16 @@ import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from import type { PaginationProps } from '../types/pagination'; import type { DynamicProps } from '/#/utils'; import type { FormActionType } from '/@/components/Form'; -import type { WatchStopHandle } from 'vue'; +// import type { WatchStopHandle } from 'vue'; import { getDynamicProps } from '/@/utils'; -import { ref, onUnmounted, unref, watch, toRaw } from 'vue'; +import { + ref, + onUnmounted, + unref, + // watch, + toRaw, +} from 'vue'; import { isProdMode } from '/@/utils/env'; import { error } from '/@/utils/log'; @@ -25,7 +31,7 @@ export function useTable(tableProps?: Props): [ const loadedRef = ref>(false); const formRef = ref>(null); - let stopWatch: WatchStopHandle; + // let stopWatch: WatchStopHandle; function register(instance: TableActionType, formInstance: UseTableMethod) { isProdMode() && @@ -41,18 +47,18 @@ export function useTable(tableProps?: Props): [ tableProps && instance.setProps(getDynamicProps(tableProps)); loadedRef.value = true; - stopWatch?.(); + // stopWatch?.(); - stopWatch = watch( - () => tableProps, - () => { - tableProps && instance.setProps(getDynamicProps(tableProps)); - }, - { - immediate: true, - deep: true, - } - ); + // stopWatch = watch( + // () => tableProps, + // () => { + // tableProps && instance.setProps(getDynamicProps(tableProps)); + // }, + // { + // immediate: true, + // deep: true, + // } + // ); } function getTableInstance(): TableActionType { -- GitLab