Commit 6b30c9f7bb97be4ad0af33b99072ec8bef26af90

Authored by luoawai
Committed by GitHub
1 parent aedb8e53

fix(useFormItem):修复ApiSelect的onChange事件获取不到第二个参数(#2592) (#2674)

src/hooks/component/useFormItem.ts
1 import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue'; 1 import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue';
2 -import { reactive, readonly, computed, getCurrentInstance, watchEffect, unref, toRaw } from 'vue'; 2 +import { reactive, readonly, computed, getCurrentInstance, watchEffect, unref, toRaw, nextTick } from 'vue';
3 3
4 import { isEqual } from 'lodash-es'; 4 import { isEqual } from 'lodash-es';
5 5
@@ -41,7 +41,9 @@ export function useRuleFormItem<T extends Recordable>( @@ -41,7 +41,9 @@ export function useRuleFormItem<T extends Recordable>(
41 if (isEqual(value, defaultState.value)) return; 41 if (isEqual(value, defaultState.value)) return;
42 42
43 innerState.value = value as T[keyof T]; 43 innerState.value = value as T[keyof T];
44 - emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])); 44 + nextTick(()=>{
  45 + emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || []));
  46 + })
45 }, 47 },
46 }); 48 });
47 49