-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Boolean props without a value are not defaulted to true when there is a v-bind applied if they begin with on
#7871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
on
The prefix 'on' is considered an event. It is not recommended to use the 'on' prefix as a boolean attribute. |
I appreciate that but this is not obvious from the docs and it is something that is difficult to change in large applications when moving from Vue 2 to Vue 3. |
Maybe some warning print on console would be better? Developer could be hinted by the warning and realize where the problem are when they stuck into this situation. |
You're right in that docs would profit from an update in that regard. The general behavior is considered public API though and won't be changed in 3.x.
Hard to do right considering it's technically fine to pass an event listener as a prop prefixed with |
Are you saying that this won't be fixed? |
We also ran into this issue when upgrading from vue2 and it was really hard to figure it out. Is it documented anywhere that prop names beginning with "on" are problematic? A warning in the console would have been great. |
Vue version
3.2.47
Link to minimal reproduction
https://codesandbox.io/s/infallible-hofstadter-eetgd6?file=/src/components/HelloWorld.vue
Steps to reproduce
What is expected?
onSomething
prop should default to trueWhat is actually happening?
The prop is ignored.
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: