Description
What problem does this feature solve?
When working with a namespaced module (e.g. a users module), you can access items on the user module's state like this:
this.$store.state.users.user
However, you can't access getters in the same way. This will return an error:
this.$store.getters.users.newUsers
Because getters.users
is undefined. Instead you have to access it with bracket notation: this.$store.getters['users/newUsers']
This is true even though, without modules, I can access getters with dot notation:
this.$store.getters.newUsers
Is there a reason why this isn't possible with getters? It would be nice if we could access namespaced getters in the same way we can with namespaced state. This current behavior seems inconsistent.
What does the proposed API look like?
Given a users
namespaced module, add the ability to access getters with: this.$store.getters.users.newUsers