javascript - What does commit mutation mean in actions in vuex? I don't quite understand it.
習慣沉默
習慣沉默 2017-05-19 10:43:29
0
2
753

習慣沉默
習慣沉默

reply all(2)
小葫芦

Trigger the increment in actions, context.commit("increment") triggers the increment function in mutations, this is the process

大家讲道理

I am also new to VuexNot long ago, let me briefly talk about my understanding.

Store理解为一个仓库,action是一次操作,mutation是让仓库中存储的东西产生某种变化的方式,state is the current status of the stored thing.

One operation may need to change the data, and another operation also needs to make the same change to the data. Then this change can be extracted and called a mutation,这样,通过commit触发指定的mutation. There is no need to mix it with the code that operates the business, resulting in code The result is clutter and poor maintainability.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template