Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upProvide warning when data/watch/computed etc. conflicts with existing Vue object properties #10884
Comments
This comment has been minimized.
This comment has been minimized.
the conflict doesn't come from Vue, it comes from a library adding it. The warning should be implemented there |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What problem does this feature solve?
I accidentally created a data attribute called
language
. It seems this attribute conflicts with some existing properties of Vue object.There were no warnings, but the attribute won't be updated by
this.$data.language
, it stays as initial value. All other data attributes do work correctly. Whenconsole.log(this.$data)
'd it shows 2language
properties, one with initial value, the other is dynamic as(...)
. After changing this attribute tolang
everything works.Considering data/watch/computed etc. all ends up as properties of Vue object, it would be nice to have some warning or exception if there are conflicts.
What does the proposed API look like?
AttributeError: "language" is a reserved property name and should not be avoided.