0👍
Two mistakes that I see:
- Computed property
blogById
has the exact same name as your Vuex getterblogById
. So you might be unintentionaly overwritting your Vuex getter in this component. Change it togetBlogById()
computed: {
...mapGetters({
blogById: "blogById",
}),
blogById() {
return this.blogById(this.id);
},
},
v-model
is read/write, so you’re trying to write to a value that should only be used for reading. Getters are for reading, and mutations are for writing to a variable in Vuex state. Change it to:value="getBlogById.htmlCode"
so then it is correct, as then you only read from the getter.
<textarea
v-model="blogById.htmlCode"
cols="30"
rows="10"
spellcheck="false"
></textarea>
Source:stackexchange.com