Let’s assume I have an object variable in my page data:
export default { data: () { myObj: { id: 1, value: 'first', code: 'xxx' } } }
Then I want to update one of the object properties, for example myObj.value. I tried it in two different ways:
self.$setState({myObj['value']: 'second'});
and
self.myObj['value'] = 'second';
self.$update();
First way throws error, and second way deletes all other properties from myObj, leaving only value: 'second'
.
What is the proper way to update only one property? (Framework7 v 5.7)