A source code analyze project created by implement vuex test cases
Construct module tree
├── ModuleCollection (_children)
│ ├── Module-A (_children)
│ │ ├── Module-A-A
│ │ │ └── ...
│ ├── Module-B (_children)
│ │ ├── Module-B-A
│ ├── ..
...
//Single Module
_raw_module = {
state,
getters,
actions,
mutations
}
- update rootState
Vue.set(parentState,namespace,newState)
- make Module local context
Solve subModule inner function and data access
// context structure
{
dispatch,
commit,
getters,
state
}
- update and wrap root context
Based on subModule and namespace
// map to submodule
{
_actions,
_mutations,
_wrappedGetters
}
- recursive run step 3
Based on Registered Module tree
every time after module changed
- make store getters computed based on Install Module's step 3
- make state reactive