Vuex updates the view after adding data

by calling an interface, adding a piece of data and returning the added data, how to update the view? what I don"t understand is that every time the operation of adding, deleting, deleting or modifying has to call the interface to obtain the data again, to achieve the view update

Mar.05,2021

invokes the interface asynchronously through action, and then submits the mutation to update the vuex data. Use getter to get data where components are needed.


post your store definition to have a look ~
normally as mentioned above, call getter in the component


write the calling interface in mutation
and then each time the component dispatch mutation modifies getters


in the getters
component computed store to call the interface again, this kind of data is not suitable for management in vuex. It is best to retrieve the data again. Because it is possible that there is a bug in the backend, a correct answer is returned, but the data is not added, or choices such as sorting are made, so I think it is best to retrieve the data again.

Menu