vue, we will frequently operate a variety of data, but sometimes found after you modify data, dom not updated?
For example, there is an array of objects:
obj = [{'name': 'joy'},{'name': 'bowen'}]
I want to insert a property through the bad, or modify the value of a property:
for (the let I = 0; I <obj.length; I ++) {
obj [I] .year = '20 is'
}
found successful array can be modified, but does not update the dom element, that is why?
The reason: change vue intercepted object, but can not monitor the objects change their properties, so I can not update dom, unless we update this array:
this.$set( target , key , value )
Forced to render the page
target: To change the data sources (which may be an object or array);
key: specific data to be changed;
value: re-assigned value;
Hope this helps!