Skip to content

Update getter docs #601

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

Merged
merged 2 commits into from
Jan 27, 2017
Merged

Update getter docs #601

merged 2 commits into from
Jan 27, 2017

Conversation

mudrz
Copy link

@mudrz mudrz commented Jan 26, 2017

Add possibility to return functions in getters (#598)

Add possibility to return functions in getters (#598)
return getters.todos.find(todo => todo.id === id)
}
// function syntax
getTodoById: function(state, getters){
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? I feel only the arrow function example is enough.

Choose a reason for hiding this comment

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

Honestly, I didn't I know you could do this with getters until I saw this commit. I'm sure many like myself will also benefit from this example.

Copy link
Member

Choose a reason for hiding this comment

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

As this example has the same meaning as the above example, I'm still not sure why we need both the arrow function and normal function version in Vuex docs.

@@ -61,6 +61,27 @@ computed: {
}
```

You can also return functions in getters:
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if there is a statement that describes this pattern is for passing some arguments to getters. 🙂

more detailed description and removed function syntax
@mudrz
Copy link
Author

mudrz commented Jan 27, 2017

Added a bit more details on possible uses to the description

@ktsn
Copy link
Member

ktsn commented Jan 27, 2017

Thanks!

@ktsn ktsn merged commit 4d796b0 into vuejs:dev Jan 27, 2017
@mudrz mudrz deleted the patch-1 branch January 31, 2017 12:24
ktsn added a commit to ktsn/vuex that referenced this pull request Feb 19, 2017
@ktsn ktsn mentioned this pull request Feb 19, 2017
ktsn added a commit that referenced this pull request Feb 20, 2017
* Update getter docs #601 for ja

* [docs] add a note that registerModule can receive an array of string #634 for ja
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.

4 participants