You can modify state? in the getters of vuex.

there is an array list, in store.state. I created a getList, in getters and then mapGetters the getList into a subcomponent. In this subcomponent, I forEach, the getList array and modify the value of item in it. I found that it seems that the list of all components has been refreshed by Synchronize.

according to my previous understanding, getters cannot modify the original array, but mutation can, but now getter can. Whether
or getter/mutation can modify the original data is actually a requirement of programming style, and there is no actual limit. In fact, you can change if you want?

Apr.10,2021

I understand it as the computed attribute


the first reaction, not because of getters, but because of object modification, which should not happen if you copy it first and then modify it.


it is suspected that there is no strict mode, so you can modify


directly by reference. The willingness of getter is to process raw data and return new data

.
Menu