diff --git a/src/components/Form/src/components/ApiSelect.vue b/src/components/Form/src/components/ApiSelect.vue index 224bc07f..1c2e8054 100644 --- a/src/components/Form/src/components/ApiSelect.vue +++ b/src/components/Form/src/components/ApiSelect.vue @@ -126,6 +126,7 @@ function emitChange() { } function handleChange(_, ...args) { + emit('change', args[0] ? args[0].value : undefined) emitData.value = args } diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 121980a8..cbd4bfec 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -85,5 +85,4 @@ export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [ 'AutoComplete', 'RadioButtonGroup', 'ImageUpload', - 'ApiSelect', ] diff --git a/src/hooks/component/useFormItem.ts b/src/hooks/component/useFormItem.ts index 282376d2..652027f8 100644 --- a/src/hooks/component/useFormItem.ts +++ b/src/hooks/component/useFormItem.ts @@ -1,5 +1,5 @@ import type { DeepReadonly, Ref, UnwrapRef, WritableComputedRef } from 'vue' -import { computed, getCurrentInstance, reactive, readonly, toRaw, unref, watchEffect } from 'vue' +import { computed, getCurrentInstance, nextTick, reactive, readonly, toRaw, unref, watchEffect } from 'vue' import { isEqual } from 'lodash-es' @@ -37,7 +37,9 @@ export function useRuleFormItem(props: T, key: keyof T = ' return innerState.value = value as T[keyof T] - emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])) + nextTick(() => { + emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])) + }) }, })