Commit bcad95d32a08a73f84ecbabab409cd64159f4077

Authored by 无木
1 parent 125a7d14

fix(form): fix form update problem

修复表单组件在特定情况下的卡顿、崩溃问题
fix: #720
src/components/Form/src/hooks/useAdvanced.ts
@@ -7,6 +7,7 @@ import { computed, unref, watch } from 'vue'; @@ -7,6 +7,7 @@ import { computed, unref, watch } from 'vue';
7 import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is'; 7 import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
8 8
9 import { useBreakpoint } from '/@/hooks/event/useBreakpoint'; 9 import { useBreakpoint } from '/@/hooks/event/useBreakpoint';
  10 +import { useDebounceFn } from '@vueuse/core';
10 11
11 const BASIC_COL_LEN = 24; 12 const BASIC_COL_LEN = 24;
12 13
@@ -49,12 +50,14 @@ export default function ({ @@ -49,12 +50,14 @@ export default function ({
49 return 0; 50 return 0;
50 }); 51 });
51 52
  53 + const debounceUpdateAdvanced = useDebounceFn(updateAdvanced, 30);
  54 +
52 watch( 55 watch(
53 [() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)], 56 [() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)],
54 () => { 57 () => {
55 const { showAdvancedButton } = unref(getProps); 58 const { showAdvancedButton } = unref(getProps);
56 if (showAdvancedButton) { 59 if (showAdvancedButton) {
57 - updateAdvanced(); 60 + debounceUpdateAdvanced();
58 } 61 }
59 }, 62 },
60 { immediate: true } 63 { immediate: true }