I created a radio button component on which emits an event but my v-model remains empty I do not see where the problem comes from I am no error in the console
import components RadioButton DATA gender: '';
<RadioButton group="gender" val="Mme" label="Mme" :model="gender" />
component
<template>
<div class="radioButton">
<label :for="`radio${uuid}`">{{ label }}</label>
<input
:disabled="disabled"
:name="group"
type="radio"
:id="`radio${uuid}`"
:value="val"
:checked="value === val"
@click="$emit('update:val', $event.target.value)"
/>
</div>
</template>
<script>
import { uuid } from 'vue-uuid';
export default {
name: 'RadioButton',
emits: ['update:val'],
model: {
props: 'val',
event: 'update:val'
},
props: {
val: { type: [String, Number], required: true },
value: { type: [String, Number], required: true },
group: { type: String, required: true },
label: { type: String, required: true },
disabled: { type: Boolean, default: false },
variant: { type: String, default: null }
},
data() {
return {
uuid: uuid.v4()
};
}
};
</script>