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

Data method of components to be called with this #6739

Closed
cathrinevaage opened this issue Oct 4, 2017 · 2 comments
Closed

Data method of components to be called with this #6739

cathrinevaage opened this issue Oct 4, 2017 · 2 comments

Comments

@cathrinevaage
Copy link

cathrinevaage commented Oct 4, 2017

What problem does this feature solve?

When a computed value is computed, it's called with this as a parameter.
This allows us to write code like this:

computed: {
  isHome: ({ $route }) => $route.name === 'home',
}

The same can't be done with the data method, due to it not being called with this.

What does the proposed API look like?

data: ({ $someProperty }) => ({
  someString: $someProperty.someString + " + something else",
}),
@yyx990803
Copy link
Member

close via #6760

@exarus
Copy link

exarus commented Oct 14, 2017

I think this behavior should be added to both data and computed docs

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

No branches or pull requests

3 participants