Warn if parent component tries to bind a prop using `v-model:xxx` but the child component doesn't declare a prop named `xxx`
What problem does this feature solve?
All vue2 repos uses v-model
for 2-way bindings, but vue3 changed the default prop to bind of v-model
. Generating a warning with undesired v-model
usage will greatly simplify the migration of 2-3
What does the proposed API look like?
N/A
Can you provide a reproduction link? In this way, others can help you better 😁
Here it is: https://jsfiddle.net/j1h8z9cb/1/
I believe in Vue 3 prop declarations are optional.
- For functional component: yes.
- For normal component: no.
We can't warn it in every case since technically you can let v-model
generated props fall through to an inner component.
As for making it easier to migrate to the new usage, that belongs to the migration build where we try to provide v2 compatibility and detailed warnings when possible. v-model
will definitely be covered since it's a pretty major change.