0👍
you emit unknown property, it’s a post
, not posts
and learn about JS object, there are copy by reference & value
maybe you just need to update your addResume method like this
addResume() {
const post = JSON.parse(JSON.stringify(this.post))
this.$emit("resumeHandler", post)
}
- [Vuejs]-Enable button when options are changed after data is received from API vue.js without lodash
- [Vuejs]-Vuetify tabs with components – mounted called twice on components
0👍
It’s not the problem that the object is reactive but that it’s the same object because objects are passed by reference in JavaScript. If it’s modified in one place, it’s modified everywhere.
In order to avoid this, the object needs to be explicitly copied. For shallow object this can be done with object spread:
this.$emit("resumeHandler", {...this.post})
For deeply nested objects, multiple spreads or third-party clone function can be used.
- [Vuejs]-Vuex4 state populated with api call is undefined in component
- [Vuejs]-Customizing the height of a bootstrap-vue Sidebar
Source:stackexchange.com