From 6b30c9f7bb97be4ad0af33b99072ec8bef26af90 Mon Sep 17 00:00:00 2001 From: luoawai <32483950+luoawai@users.noreply.github.com> Date: Wed, 5 Apr 2023 15:58:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(useFormItem):=E4=BF=AE=E5=A4=8DApiSelect?= =?UTF-8?q?=E7=9A=84onChange=E4=BA=8B=E4=BB=B6=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=8F=82=E6=95=B0(#2592)?= =?UTF-8?q?=20(#2674)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/component/useFormItem.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/component/useFormItem.ts b/src/hooks/component/useFormItem.ts index 84da1c3d..2128fa4f 100644 --- a/src/hooks/component/useFormItem.ts +++ b/src/hooks/component/useFormItem.ts @@ -1,5 +1,5 @@ import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue'; -import { reactive, readonly, computed, getCurrentInstance, watchEffect, unref, toRaw } from 'vue'; +import { reactive, readonly, computed, getCurrentInstance, watchEffect, unref, toRaw, nextTick } from 'vue'; import { isEqual } from 'lodash-es'; @@ -41,7 +41,9 @@ export function useRuleFormItem( if (isEqual(value, defaultState.value)) return; innerState.value = value as T[keyof T]; - emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])); + nextTick(()=>{ + emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])); + }) }, }); -- GitLab