Closed
Description
Documentations states that this:
app.component('TodoItem', {
props: {
todo: {
type: Object,
required: true
}
},
template: '<input v-model="todo.text">'
})
should be converted to this:
app.component('TodoItem', {
props: {
todo: {
type: Object,
required: true
}
},
template: `
<input
:value="todo.text"
@input="$emit('input', $event.target.value)"
>
`
})
Assuming it has same functional goal this is not true - if parent of this component will pass todo through ie v-model
then input
event will override passed todo
model with a string ($event.target.value
). If parent is not using v-model but simply :todo="todo"
then how would it know that $emit('input', $event.target.value)
corresponds to text
property of provided model ?
Metadata
Metadata
Assignees
Labels
No labels