Sfoglia il codice sorgente

describe options argument of dispatch/commit in api docs (#743)

katashin 8 anni fa
parent
commit
1b889aa213
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 7 7
      docs/en/api.md

+ 7 - 7
docs/en/api.md

@@ -54,16 +54,16 @@ const store = new Vuex.Store({ ...options })
     state,     // will be module local state if defined in a module.
     getters    // same as store.getters
     ```
-    
+
     Specific when defined in a module
-    
+
     ```
     state,       // will be module local state if defined in a module.
     getters,     // module local getters of the current module
     rootState,   // global state
     rootGetters  // all getters
     ```
-    
+
     Registered getters are exposed on `store.getters`.
 
     [Details](getters.md)
@@ -125,13 +125,13 @@ const store = new Vuex.Store({ ...options })
 
 ### Vuex.Store Instance Methods
 
-- **`commit(type: string, payload?: any) | commit(mutation: Object)`**
+- **`commit(type: string, payload?: any, options?: Object) | commit(mutation: Object, options?: Object)`**
 
-  Commit a mutation. [Details](mutations.md)
+  Commit a mutation. `options` can have `root: true` that allows to commit root mutations in [namespaced modules](modules.md#namespacing). [Details](mutations.md)
 
-- **`dispatch(type: string, payload?: any) | dispatch(action: Object)`**
+- **`dispatch(type: string, payload?: any, options?: Object) | dispatch(action: Object, options?: Object)`**
 
-  Dispatch an action. Returns a Promise that resolves all triggered action handlers. [Details](actions.md)
+  Dispatch an action. `options` can have `root: true` that allows to dispatch root actions in [namespaced modules](modules.md#namespacing). Returns a Promise that resolves all triggered action handlers. [Details](actions.md)
 
 - **`replaceState(state: Object)`**