search
HomeCommon ProblemWhat are the five core attributes of vuex

The five core attributes of vuex are state, getters, mutations, actions and modules. State is the basic data of vuex, which is used to store variables. Geeter is data derived from basic data, which is equivalent to the calculated attribute of state.

What are the five core attributes of vuex

The operating environment of this article: windows10 system, vue 2.5.2, thinkpad t480 computer.

The five core attributes in Vuex are: state, getters, mutations, actions, modules.

Let’s take a look at these five attributes.

state: basic data of vuex, used to store variables

geeter: data derived from basic data (state), equivalent to the calculated attribute of state

mutation: Submit The method of updating data must be synchronous (if you need to use action asynchronously). Each mutation has a string event type (type) and a callback function (handler).

The callback function is where we actually change the state, and it will accept state as the first parameter and submit the payload as the second parameter.

Action: The function is roughly the same as mutation. The difference is ==》1. Action submits a mutation instead of directly changing the state. 2. Action can contain any asynchronous operation.

modules: Modular vuex allows each module to have its own state, mutation, action, and getters, making the structure very clear and easy to manage.

Related video sharing: Programming video

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

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools