0👍
You can take a few approaches to deal with this:
-
You could treat it like an array you want to update, in this case
you could do something like this:vm.$set(this.puzzleGrid[0], 0, {
which will replace the entire object from
"coordinates": { "x": 3, "y": 0 }, "state": { "free": false,
"label": 2 } });
this.puzzleGrid[0][0]
with{ "coordinates": { "x": 3, "y": 0 },
.
"state": { "free": false, "label": 2 } } -
You could update an object contained in the array directly, doing something like this:
this.$set(this.puzzleGrid[0][0], 'state', { "free": false, "label":
which will replace the value on
4 })state
with this:{ "free":
on the object contained in
false, "label": 4 }this.puzzleGrid[0][0]
. -
Also update property by property on an object of the array:
this.$set(this.puzzleGrid[0][0]['state'], 'free', false)
.