vuex state

Vuex five state property management Summary:

  1.state attributes: Defining warehouse for storing data can be accessed through this $ store.state or mapState..

        

    2.getter property: to get the value of the store, can be considered to calculate the properties store, you can mapGetters or accessed through this $ store.getter.

   3.mutation property: synchronous change the value of the store, nothing will be set up sync it? Because the mutation is directly change the value of the store, Vue operation will be recorded, if it is unable to track the asynchronous change, can be called by mapMutations.

                                     

 

    4.action: asynchronous call function performs mutation, change the value of the store, you can access this $ dispatch or mapActions.

    5.modules: module, if the state too, can be split into modules, the last entry in the "..." into the structure. 

 

 

 

 

      

 

 

 

 

 

 

 

 

--- end --- restore content

Guess you like

Origin www.cnblogs.com/lishaoxiong/p/11728783.html