Skip to content

Commit 5ea7038

Browse files
taonicktsn
authored andcommitted
Add rootState to module action's example code (vuejs#581)
This matches the description above, where `context.rootState` is mentioned but does not appear in the example code previously.
1 parent 2ae1066 commit 5ea7038

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/en/modules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ Similarly, inside module actions, `context.state` will expose the local state, a
5757
const moduleA = {
5858
// ...
5959
actions: {
60-
incrementIfOdd ({ state, commit }) {
61-
if (state.count % 2 === 1) {
60+
incrementIfOddOnRootSum ({ state, commit, rootState }) {
61+
if (state.count + rootState.count % 2 === 1) {
6262
commit('increment')
6363
}
6464
}

0 commit comments

Comments
 (0)