Understanding of the company's framework

 On the front:

   I was just into a white line near the front, the company recently because of new entrants into the job, learning a new architecture, here to talk about their understanding of the company's architecture.

Use vuex unified state management:  

 The company is using a front-end framework vue framework, this would not have said, from the popular level of vue, the choice vue is the right choice. Here is the specific structure of the company to say that all of the state management data and network requests are made through vuex. Before I knew vuex usage scenario is similar to the shopping cart page so many share some data when it is using vuex, because a lot of pages need some data public, through the words of brother traditional values ​​of the components too inconvenient. Now the company used all of the state management architecture and data network requests are made through vuex, this beginning is not too understanding, feeling too much trouble. Now I feel doing so also has his benefits, although all the data and network requests by vuex state management would be more trouble, but so many people write code highly readable, then developed and enhanced post-code maintainability, so the benefits of, or more. Then explain to you talk about some of the basic concepts of vuex:

The main concept Vuex as follows:

(1) .Store
express reference to the global Vuex object. Vuex components to access objects by State Store
(2) .State
Vuex state of the object, i.e. its possession data (corresponding to each file vue State)
(. 3) .Getter
corresponding to the calculated properties of Store. Because, like calculation of property, like, Getter return value based on its dependencies are cached, and only when it is dependent on the value has changed it will be recalculated. (Equivalent property calculated)
(. 4) .Mutation
defined modification operations on the data in the State. State of the component using the data when the data can not directly modify the operation, the operation to call Mutation defined to achieve modification of data. This is also mentioned in the definition of Vuex with the appropriate rules for data make specific changes (this is equivalent to the method, it must be noted in vuex you want to change the data in the state only through Mutation)
(5) .Action
Mutation can perform operations defined in the synchronous operation, Vuex asynchronous operation in the Action, Action finally updated data by calling Mutation operation
(6) .Module
layer between the Store and State, facilitate large-scale project management, Store comprises a plurality Module, Module comprising State, Mutation and Action



Here I will say this much, if you want to learn more about the basics and can be accessed using the following link to see vuex official document:



Guess you like

Origin www.cnblogs.com/zhengyufeng/p/10922481.html