Reputation: 285
On click, I want to push to array. It works if I manually refresh the Vue extension in the console of Google Chrome but otherwise not
completeStep(index, key) {
let currentSet = index + key
if (this.exercise_completed[index].indexOf(currentSet) === -1) {
this.exercise_completed[index].push(currentSet)
} else {
this.exercise_completed[index].splice(this.exercise_completed[index].indexOf(currentSet), 1)
}
}
Upvotes: 0
Views: 59
Reputation: 51
maybe try to use this.$forceUpdate();
when you make the change.
https://v2.vuejs.org/v2/api/#vm-forceUpdate
Hope this helps
Upvotes: 1
Reputation: 5048
I would recommend making a key and changing the key on changes in the array. See here: https://michaelnthiessen.com/force-re-render
Upvotes: 1