Vue.set( target, propertyName/index, value )

Vue.set( target, propertyName/index, value )

Arguments:
    {Object | Array} target
    {string | number} propertyName/index
    {any} value

Returns: the set value.

Usage:

Adds a property to a reactive object, ensuring the new property is also reactive, so triggers view updates. This must be used to add new properties to reactive objects, as Vue cannot detect normal property additions (e.g. this.myObject.newProperty = 'hi').

The target object cannot be a Vue instance, or the root data object of a Vue instance.

See also: Reactivity in Depth
Published 133 original articles · praised 189 · 10,000+ views

Guess you like

Origin blog.csdn.net/blog_programb/article/details/105603324