On the other hand, v-model checkbox and radio button input elements always bind the checked attribute with a Boolean value that is updated on the change event, as in the following example:
<input type="checkbox" v-model="subscribe" value="yes" name="subscribe">
The v-model checkbox input element in the preceding code snippet is indeed shorthand for the following:
<input
type="checkbox"
name="subscribe"
value="yes"
v-bind:checked="false"
v-on:change="subscribe = $event.target.checked"
>
And so, a custom checkbox input element, too, must always comply with the nature of the v-model checkbox input element (shown in the preceding code block) by adopting the checked prop and the change event in the model property as follows:
Vue.component('custom-checkbox', {
props: {
checked: Boolean,
},
model: {
prop: 'checked...