Skip to content

$set for modifying objects in array for reactivity #4443

Closed
@donnyjeremiah

Description

@donnyjeremiah

Vue.js version

2.1.0

Problem:

I can't update an object in my array of objects editedPlayers[] when I use this.$set(). When I try to do this.editedPlayers.$set(id, this.editedPlayers[id].stats[type] + 1). I know this is wrong.

editedPlayers[{stats:{goals: 12, assists:3, played: 10}}, {stats:{goals: 23, assists:7, played: 30}}]

I want to update the stats.goals in editedPlayers[someId]. Since $set or splice() can be used to substitute the current index value with another, I want just to modify it (ie: stats.goals). What do I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions