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

Warn when defining a method with same name as a prop #4950

Merged
merged 2 commits into from
Feb 18, 2017

Conversation

chriscasola
Copy link
Contributor

When you specify a method on a component with the same name as a prop you get an error about mutating a prop directly, but it can be hard for people new to vue to figure out what this means.

This PR adds a more explicit warning message indicating exactly what went wrong.

@rohmanhm
Copy link
Contributor

That's was great 👍🏼

}
if (props && hasOwn(props, key)) {
warn(
`method "${key}" has already been defined as a property value.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply say as a prop it's clearer and already in other warnings 🙂

@chriscasola
Copy link
Contributor Author

@posva thanks for the feedback. Updated.

@yyx990803 yyx990803 merged commit 3dc9338 into vuejs:dev Feb 18, 2017
@yyx990803
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants