Vuex concept explanation

 Official explanation: Vuex is a state management model + library specially developed for Vue.js applications

Vuex installation:

        Method 1: When creating a project on scaffolding, check the option of vuex and the system will automatically install it (scaffolding installation does not require any configuration)

        Method 2: npm installation: npm install vuex@next --save

Core idea:

               1: State is similar to data and can be called in any component

                        (1) Call: <div>{ {$store.state.data name}}</div> 

                2: Mutation: The only way to change the state in Vuex's store is to submit a mutation

                3: Action simulates asynchronous operation in Vuex
                        (1) call: you can call it directly using this.$store.dispatch('defined function name')

                4: Getter processes the data in the store to form new data

                5: Modules divide the store into modules, each module has its own state, mutation, action, getter

Guess you like

Origin blog.csdn.net/longyan_tianyu/article/details/128475041