Browse Source

fix: 修复表单自定义组件验证不通过的bug

pull/768/head
cKey 3 years ago
parent
commit
add9565281
  1. 14
      apps/vue/src/hooks/component/useFormItem.ts

14
apps/vue/src/hooks/component/useFormItem.ts

@ -1,13 +1,5 @@
import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue'; import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue';
import { import { reactive, readonly, computed, getCurrentInstance, watchEffect, unref, toRaw } from 'vue';
reactive,
readonly,
computed,
getCurrentInstance,
watchEffect,
unref,
toRaw,
} from 'vue';
import { isEqual } from 'lodash-es'; import { isEqual } from 'lodash-es';
@ -49,7 +41,9 @@ export function useRuleFormItem<T extends Recordable>(
if (isEqual(value, defaultState.value)) return; if (isEqual(value, defaultState.value)) return;
innerState.value = value as T[keyof T]; innerState.value = value as T[keyof T];
emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])); setTimeout(() => {
emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || []));
});
}, },
}); });

Loading…
Cancel
Save