javascript - vuex, getters are only executed once, data update getters data is not updated
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-28 09:25:43
0
4
1555

I encountered a problem in the project. I used vuex to manage state and data. Actions->mutations->state uses this method to modify state data. Getters obtain data. In the component, computed updates the obtained data. Problem The data is updated in mutations, but not in getters, and why is the getters only executed once?

In store:

In component:

Triggering the submitForm() method will request data

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
扔个三星炸死你

getters less return

伊谢尔伦

I suggest you take a good look at the official vuex documentation. Mutation changes an attribute of the state, not directly changing the state itself

淡淡烟草味

The problem is solved. There are several solutions. One is to use mapState, and the other is to change this
into an assignment form

为情所困

@Msevensun My current situation is the same as yours, but when I use mapState, why does it still print the initial data instead of the asynchronously changed data?

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