Explorar o código

Add rootState to module action's example code (#581)

This matches the description above, where `context.rootState` is mentioned but does not appear in the example code previously.
Tao Guo %!s(int64=8) %!d(string=hai) anos
pai
achega
5ea7038903
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      docs/en/modules.md

+ 2 - 2
docs/en/modules.md

@@ -57,8 +57,8 @@ Similarly, inside module actions, `context.state` will expose the local state, a
 const moduleA = {
   // ...
   actions: {
-    incrementIfOdd ({ state, commit }) {
-      if (state.count % 2 === 1) {
+    incrementIfOddOnRootSum ({ state, commit, rootState }) {
+      if (state.count + rootState.count % 2 === 1) {
         commit('increment')
       }
     }