Five minutes to get to know Vuex

vuex is a specially developed for the vue.js application state management.

This state we can be understood as properties in the data, we need to share some of the other component.

In other words, we need to share data, use vuex unified centralized management.

vuex, there are five basic default object:

  • state: storing state (variable)
  • getters: to re-compile the previous data acquisition, can be understood as the calculation of state property. We use the $ sotre.getters.fun in the component ()
  • mutations: modified state, and is synchronous. Use $ store.commit ( '', params) in the assembly. This component of our custom event similar.
  • actions: asynchronous operation. Is used in the assembly $ store.dispath ( '')
  • modules: store sub-module, in order to develop large-scale projects to facilitate the management and use of state. We will not explain here, and with them the same as above.

Here we started, step by step using vuex

 

Guess you like

Origin www.cnblogs.com/Rivend/p/11932178.html