Skip to content

Commit

Permalink
fix(form): fix form update problem
Browse files Browse the repository at this point in the history
修复表单组件在特定情况下的卡顿、崩溃问题
fix: #720
  • Loading branch information
mynetfan committed Jun 7, 2021
1 parent 125a7d1 commit bcad95d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Form/src/hooks/useAdvanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { computed, unref, watch } from 'vue';
import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';

import { useBreakpoint } from '/@/hooks/event/useBreakpoint';
import { useDebounceFn } from '@vueuse/core';

const BASIC_COL_LEN = 24;

Expand Down Expand Up @@ -49,12 +50,14 @@ export default function ({
return 0;
});

const debounceUpdateAdvanced = useDebounceFn(updateAdvanced, 30);

watch(
[() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)],
() => {
const { showAdvancedButton } = unref(getProps);
if (showAdvancedButton) {
updateAdvanced();
debounceUpdateAdvanced();
}
},
{ immediate: true }
Expand Down

0 comments on commit bcad95d

Please sign in to comment.