Skip to content

Commit 49eb1ba

Browse files
committed
fix(select): emit input & change events when option is selected
1 parent d8efaa5 commit 49eb1ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/anu-vue/src/components/select/ASelect.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const props = defineProps(defu({
2424
}, baseInputProps))
2525
2626
const emit = defineEmits<{
27-
28-
// (e: 'input', value: (ExtractPropTypes<typeof props>)['modelValue']): void
27+
(e: 'change', value: (ExtractPropTypes<typeof props>)['modelValue']): void
28+
(e: 'input', value: (ExtractPropTypes<typeof props>)['modelValue']): void
2929
(e: 'update:modelValue', value: (ExtractPropTypes<typeof props>)['modelValue']): void
3030
}>()
3131
@@ -108,8 +108,8 @@ const optionClasses = 'a-select-option states before:transition-none cursor-poin
108108
const handleOptionClick = (option: SelectOption) => {
109109
const value = isObjectOption(option) && !props.emitObject ? (option as ObjectOption).value : option
110110
111-
// Do we really need this emit? 🤔 => I guess no because now on all events get attached to input
112-
// emit('input', value)
111+
emit('change', value)
112+
emit('input', value)
113113
emit('update:modelValue', value)
114114
}
115115
const closeOptions = (event: MouseEvent) => {

0 commit comments

Comments
 (0)