[Vuejs]-DOM is not re-rendering on change of data in vue

0👍

You can use nextTick. It’s allows you to do something after you have changed the data and VueJS has updated the DOM based on your data change, but before the browser has rendered those changed on the page.

0👍

Try changing this.onSuccess to this.onSuccess.bind(this). onSuccess is likely losing context while called as a callback within window.restEntity

0👍

Presumably your assignment is losing the reactivity enhancement of displayedNotification. I would try to use a spread operation:

onSuccess(response) {
    this.displayedNotification = { ... response.data};
}

$set should have the same effect, but as you want to set the whole array, not single array elements, that would be a bit more difficult to use:

onSuccess(response) {
    this.displayedNotification.splice(0); // empty the array
    response.data.forEach((val, idx) => this.$set(this.displayedNotification , idx, val));
}

Leave a comment