Skip to content

Vue.set Api strange behavior if path is a numerical string #5884

@TheDadycool

Description

@TheDadycool

Version

2.3.4

Reproduction link

https://jsfiddle.net/v0dbnvv0/1/

Steps to reproduce

Vue.set(array, "indexInTheArrayInString", value) is not working as expected compare to Vue.set(array, "indexInTheArrayInNumericForm", value)

What is expected?

Both version working the same i suppose?

What is actually happening?

Watcher on the value are not triggered even if the value is correctly changed in the model


My currently fixed in my code:
export function AdvVueSet(obj, path, value) {
if (!isNaN(path)) {
path = +path;
}
Vue.set(obj, path, value);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions