By default, the model in a custom input component uses the value property as the prop and input as the event. Using the custom-input component from our previous example, this can be written as follows:
Vue.component('custom-input', {
props: {
value: null
},
model: {
prop: 'value', // <-- default
event: 'input' // <-- default
}
})
In this example, we don't need to specify the prop and event properties since they are the default behavior in this component's model. But this becomes useful when we don't want to use these defaults for some input types, such as checkboxes and radio buttons.
We may want to use the value attribute in these inputs for a different purpose, such as sending a specific value along with the checkbox's name to the server in the submitted data, as follows:
Vue.component('custom-checkbox', {
model: {
prop: 'checked&apos...