[Vuejs]-How Can I edit data after on a click event on VUE using VUEX?

0👍

You are saving an object this.contentClone as state, which is further bound with input and this makes input able to directly makes changes to your vuex store through v-model and hence the error; A simple fix would be clone this.contentClone when dispatch it to vuex state:

saveForm(event) {
  this.$store.dispatch("UPDATE_CONTENT", JSON.parse(JSON.stringify(this.contentClone)));
}

Or IMO a better solution would be to dispatch the result as a string instead of using an object. See the working example: https://codesandbox.io/s/mmpr4745z9

Leave a comment