Vuex calls mutations in actions to report an error

call

in actions
 commit("mapSet",map1);

mutations is

mapSet:(state,mymap)=>{
            state.mymap=mymap;
        },
        
   

where map1 is an object, that is, the parameter passed in is an object, and an error will occur when it is called

clipboard.png

mapSetactions


plugins


clipboard.png

clipboard.png

clipboard.png

clipboard.png

excuse me, what is the reason for this? How to assign values correctly?

Mar.21,2021

you can post where you use mapSet . The reason for
is that the data is not only watch in VueX , but also watch elsewhere, causing looping problems.
when setting and fetching the data of VueX , you can make a deep copy of the data, that is, remove the get/set listeners attached to Vue .

Menu