[Vuejs]-Vue JS make an array reactive

0👍

Solution

handleNewComment() {
  this.answer.parent_id = this.comment.id;
  this.answer.title = this.comment.id;

  CommentService.ask(this.answer).then(
    response => {
      this.message = response.data;
      this.editorVisible = false;
      this.$set(this.answers, this.answers.length, this.message);
      console.log(this.message);
    },
    error => {
      this.message =
        (error.response && error.response.data) ||
        error.message ||
        error.toString();
      console.log(this.message);
    }
  );
}

Just updating the index in the proper way Vue.js finally could mutate de array.

Leave a comment