Browse Source

fix(ApiSelect): 首次 onChange 无法获取到第二个参数

main
刘凯 1 year ago
parent
commit
f4d602ae61
  1. 1
      src/components/Form/src/components/ApiSelect.vue
  2. 1
      src/components/Form/src/helper.ts
  3. 6
      src/hooks/component/useFormItem.ts

1
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
}
</script>

1
src/components/Form/src/helper.ts

@ -85,5 +85,4 @@ export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [
'AutoComplete',
'RadioButtonGroup',
'ImageUpload',
'ApiSelect',
]

6
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<T extends Recordable>(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)) || []))
})
},
})

Loading…
Cancel
Save