The vuex value does not change after the asynchronous operation

initialize an object in state.

// 
travellerInfo: {
    after: {
        address: {},
        temporary: {
            people: {
                data: [],
                ids: [],
            },
            stroke: {
                data: {},
                complete: "",
            },
            take: {
                data: {},
                ids: {},
            },
            address: {
                data: {},
                ids: [],
            },
        },
        traveler: {},
    },
},


// 
commit("setTravellerInfo", this.state.travellerInfo);
setTravellerInfo(state, payload) {
    state.travellerInfo = payload;
},

when the data asynchronous request comes back, the data field in the vuex changes, but the ids field remains the same. The back-end interface has data.

/ / display of vue debugging tools
clipboard.png

// idsvuex

clipboard.png

May.20,2022

at least post the key code. It should be that you made a mistake in processing the data returned by the back end.


assignment problem, use your own code bug.
also recommend the merging method of lodash:

this.state.travellerInfo = _.merge({}, this.state.travellerInfo, res);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5192d-4513d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5192d-4513d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?