Vuex: Add module after initialization

Created on 8 Sep 2016  路  3Comments  路  Source: vuejs/vuex

Please let me know if it is possible to include a new module into the store after initial setup.

Something like:

let store = new Vuex.Store({ modules: initialModulesConfig })

// stuff happens

store.addModule(anotherModuleConfig)

Most helpful comment

FYI, store.module is renamed to store.registerModule in rc.4

All 3 comments

You can in 2.0, not in 1.0.

New API methods

store.module(path, moduleOptions)

Register a module into the store. The path argument can be either a string, or an Array of strings. When registering a nested module, its direct parent state tree must already be present.

FYI, store.module is renamed to store.registerModule in rc.4

Ooops, thanks! @ktsn

Was this page helpful?
0 / 5 - 0 ratings