Answer the question
In order to leave comments, you need to log in
How to update object properties in vuex?
Good afternoon!
How to correctly update an object (or its individual properties) in store vuex?
Let's say there is an object in store
state:{
params: {
prop1: {},
prop2: {},
prop3: {}
}
}
Answer the question
In order to leave comments, you need to log in
mutations:
case1:
setParams (state, params) {
state.params = params
}
setParamsProperty (state, obj) {
state.params = {...state.params, ...obj }
}
obj
is an object of the form:{
prop1: value1
}
{
prop1: value1,
prop2: value2
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question