Skip to content

Commit

Permalink
fix(table): try to get close to the form stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Jun 6, 2021
1 parent 19d8e01 commit d81481c
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/components/Table/src/hooks/useTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -25,7 +31,7 @@ export function useTable(tableProps?: Props): [
const loadedRef = ref<Nullable<boolean>>(false);
const formRef = ref<Nullable<UseTableMethod>>(null);

let stopWatch: WatchStopHandle;
// let stopWatch: WatchStopHandle;

function register(instance: TableActionType, formInstance: UseTableMethod) {
isProdMode() &&
Expand All @@ -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 {
Expand Down

0 comments on commit d81481c

Please sign in to comment.