fix(forms)!: normalize input emits (#1560)

This commit is contained in:
Romain Hamel
2024-03-25 15:36:36 +01:00
committed by GitHub
parent 7d6b5c358f
commit 92e736213b
9 changed files with 26 additions and 16 deletions

View File

@@ -11,6 +11,7 @@
type="radio"
:class="inputClass"
v-bind="attrs"
@change="onChange"
>
</div>
<div v-if="label || $slots.label" :class="ui.inner">
@@ -111,14 +112,16 @@ export default defineComponent({
},
set (value) {
emit('update:modelValue', value)
emit('change', value)
if (!radioGroup) {
emitFormChange()
}
}
})
function onChange (event: Event) {
emit('change', (event.target as HTMLInputElement).value)
}
const inputClass = computed(() => {
return twMerge(twJoin(
ui.value.base,
@@ -139,7 +142,8 @@ export default defineComponent({
// eslint-disable-next-line vue/no-dupe-keys
name,
// eslint-disable-next-line vue/no-dupe-keys
inputClass
inputClass,
onChange
}
}
})