1
0
Эх сурвалжийг харах

add a note that registerModule can receive an array of string (#634)

katashin 8 жил өмнө
parent
commit
16cc666881
1 өөрчлөгдсөн 7 нэмэгдсэн , 1 устгасан
  1. 7 1
      docs/en/modules.md

+ 7 - 1
docs/en/modules.md

@@ -227,12 +227,18 @@ export function createPlugin (options = {}) {
 You can register a module **after** the store has been created with the `store.registerModule` method:
 
 ``` js
+// register a module `myModule`
 store.registerModule('myModule', {
   // ...
 })
+
+// register a nested module `nested/myModule`
+store.registerModule(['nested', 'myModule'], {
+  // ...
+})
 ```
 
-The module's state will be exposed as `store.state.myModule`.
+The module's state will be exposed as `store.state.myModule` and `store.state.nested.myModule`.
 
 Dynamic module registration makes it possible for other Vue plugins to also leverage Vuex for state management by attaching a module to the application's store. For example, the [`vuex-router-sync`](https://github.com/vuejs/vuex-router-sync) library integrates vue-router with vuex by managing the application's route state in a dynamically attached module.