Home > Web Front-end > JS Tutorial > body text

What is vuex?

不言
Release: 2020-10-13 10:36:07
Original
16990 people have browsed it

Vuex is a state management model developed specifically for Vue.js applications; it uses centralized storage to manage the state of all components of the application, and uses corresponding rules to ensure that the state occurs in a predictable way. Variety. Vuex can manage the data status of complex applications, such as communication between sibling components, value transfer among multi-layer nested components, etc.

What is vuex?

Vuex is a state management pattern developed specifically for Vue.js applications. It uses centralized storage to manage the state of all components of the application, and uses corresponding rules to ensure that the state changes in a predictable way.

Vuex is also integrated into Vue’s official debugging tool devtools extension, providing advanced debugging functions such as zero-configuration time-travel debugging, state snapshot import and export, etc.

Vue uses centralized storage to manage the status of all components of the application. The key here is centralized storage management. This means that updates that originally required shared state required communication between components, but now with vuex, components all communicate with the store. This is why the official website once again mentions the value of Vuex in building large applications. If you don’t plan to open a large single-page application, using Vuex may become very cumbersome. For large projects, you can use Vuex as the state between different components. Management, and for small projects, it is recommended to use HTML5-specific attributes, localStroage and sessionStroage as data transfer.

vuex has several core concepts: State, Getter, Mutation, Action, and Module.

state stores the state we mentioned above

mutations stores how to change the state

getters derives the state from the state, such as Filter a certain state in the state and obtain the new state.

Actions is an enhanced version of mutation. It can change the state through the methods in commit mutations. The most important thing is that it can perform asynchronous operations.

modules As the name suggests, when using this container to store these states is still confusing, we can divide the container into several pieces and classify the states and management rules to install them. This is the same purpose as when we create js modules to make the code structure clearer.

【Related recommendations: JavaScript video tutorial

The above is the detailed content of What is vuex?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template