Explorar el Código

fix(form): fix form update problem

修复表单组件在特定情况下的卡顿、崩溃问题
fix: #720
无木 hace 3 años
padre
commit
bcad95d32a
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      src/components/Form/src/hooks/useAdvanced.ts

+ 4 - 1
src/components/Form/src/hooks/useAdvanced.ts

@@ -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;
 
@@ -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 }