Although vuEX has been used in the project at present, I feel that I have not thoroughly understood it and failed to give full play to its greatest advantages, so I record this article.
Vuex design concept
Definition: Vuex was developed specifically for vuejS applicationsStatus management modeIt USES theThe centralizedThe storage manages the state of all the components of the application and ensures that the state is one of the corresponding rulesA predictableVuex is also integrated into Vue’s official debugging tool, DevToolsOne-way data flow:
- state
The data source that drives the application, such as data in the Vue instance
- getters
You can think of it as a computed property of store
- mutations
The only way to change the state in Vuex’s store is to commit mutation
- actions
An Action can contain any asynchronous operation
- modules
Modules have their own state, mutation, action, getters, and even nested submodules