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

Add example for getters when using modules. #1766

Closed
wants to merge 1 commit into from

Conversation

mprevdelta
Copy link

The notation becomes different for getters when a module is present and I believe an example would be very benefical.

The notation becomes different for getters when a module is present and I believe an example would be very benefical.
@kiaking
Copy link
Member

kiaking commented Jun 8, 2020

Thank you for the PR! While it might be nice to have this section, I think it's better to keep it as is since this is explained in "Modules" page. Unless you're using module, you don't need this syntax, and if we were to add this section to the getters page, we need to add to others (state, actions, mutations) as well.

@kiaking kiaking closed this Jun 8, 2020
@kiaking kiaking added the documentation Improvements or additions to documentation label Jun 8, 2020
@mprevdelta
Copy link
Author

I would in fact argue for updating those other pages with examples or cross references, since in learning Vue the module naming convention tripped me up in those instances also (I just didn't make a pull request). Organizing the docs this way puts the onus on the reader to realize they have a special class of question--a "module question"--rather than a getter/setter/state/action/mutation question.

In the case of say, dispatching actions, I didn't find the situation so egregious because the method take a string and you know you're gonna have to pass some sort of special string:

store.dispatch('someAction')
store.dispatch('someModule.someAction') // nope
store.dispatch('someModule/someAction')  // aha!

...but in this case all of the examples lead the user to believe they'd use the dot notation.

this.$store.getters.doneTodosCount

At any rate, thank you for taking the time to review my request and for helping to make Vue a great tool.

@kiaking
Copy link
Member

kiaking commented Jun 9, 2020

I get your point. This is something people fall into quite often at the beginning. So having cross references, or link like "learn more about how to use getters with modules" might be nice to have 👍

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

Successfully merging this pull request may close these issues.

2 participants