[Vuejs]-Access and modify JSON property using v-model on VUE JS

0👍

Is there a specific reason you need a computed here? It seems more logical to fetch your data using a method and saving that result in a variable. Then you can assign the variable to the v-model like you already did in your example and it should work out of the box.

data() {
  return {
    operation_data: null
  }
},
mounted() {
  this.fetchData();
},
methods: {
  fetchData() {
    // Get your data here with axios
    this.operation_data = resultOfAxios;
  }
}

For your question on why the data doesn’t reflect back:
A computed is initially just a getter. You have to manually add a setter for the computed for it to be able to update data.

Leave a comment