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
133 artículos originales publicados · elogiados 189 · 10,000+ vistas

Supongo que te gusta

Origin blog.csdn.net/blog_programb/article/details/105603324
Recomendado
Clasificación