[Vuejs]-Vue radio boxes returning string instead of boolean

3👍

When you emit the change event from your radio component, you’re taking $event.target.value, which is the HTMLInputElement.value property that is always a string. In order to emit the boolean value prop itself, you should refer to it directly in the @change handler like this:

<input type="radio" :name="name" :id="name" class="radio-input" :checked="isChecked" :value="value" @change="$emit('change', value)">
👤kdau

Leave a comment