我有一个vuex动作会导致突变:
updateStateProperty: (state, payload) => {
state.parent.child = payload.changer // trying to modify child property - fail
}
这抛出一个:
TypeError: ""child" is read-only"
我已经看到了此示例解决方案,但缺少有关deepClone目的的解释:
setSomething(state, payload) {
let parent = deepClone(state.parent) // what is deepClone here?
parent.child = payload.changer
state.parent = parent
}
也看到了其他内容,但没有清晰的代码示例。我应该如何更改此属性?