1. Store initialization
- If it is not used
Vue.use(Vuex)
for installationVuex
, install it. In the installation phase , the hook is injectedmixin
globally, and thebeforeCreate
hook is triggered forStore
injection when the component is initialized - Recursively traverse the configuration items, initialize
module
and build themodule
tree - Recursively traverse
module
the tree, each mountedmodule
and wherein thestate
,getter
,mutation
,action
encapsulated and implanted intostore
- Create built-in
vm
instance, mapstate
andgetter
tovm
instancedata
andcomputed
attribute - Build
map
mapping function and export, provide convenienceAPI
2. Value
render
Or get data during operation.
If the getter
acquisition is passed , the built-in vm
calculation attribute process is triggered vm
, and finally data
the reactive logic in the trigger is triggered
3. Assignment
Subsequent operations modify the data.
If by action
, the trigger Store
configuration action
function, by commit
triggering mutation
the assignment of the function data, the final trigger vm
in data
response to a logical formula