Skip to content
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

Provide warning when data/watch/computed etc. conflicts with existing Vue object properties #10884

Closed
dz902 opened this issue Dec 2, 2019 · 1 comment

Comments

@dz902
Copy link

@dz902 dz902 commented Dec 2, 2019

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. When console.log(this.$data)'d it shows 2 language properties, one with initial value, the other is dynamic as (...). After changing this attribute to lang 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.

@posva

This comment has been minimized.

Copy link
Member

@posva posva commented Dec 2, 2019

the conflict doesn't come from Vue, it comes from a library adding it. The warning should be implemented there

@posva posva closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.