Answer the question
In order to leave comments, you need to log in
How to correctly bind v-model to a custom checkbox component?
Hello! Based on the documentation, the v-model binding in the checkbox and radio component should look something like this:
Vue.component('app-checkbox', {
model: {
prop: 'checked',
event: 'change'
},
props: ['name', 'value', 'checked'],
template: `
<label>
<input
type="checkbox"
:name="name"
:value="value"
:checked="checked"
@change="$emit('change', $event.target.checked)">
<slot></slot>
</label>
`
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question