When setting up the state in my Vue 3 component, I use the following approach:
data() {
return {
new_listing: this.listing //which is a prop
}
}
But when I link it to an input field like this:
<input type="text" placeholder="title" v-model="new_listing.title" />
I expect only new_listing.title
to change, but it appears that the prop listing
is also being affected. How can I ensure that only the state new_listing.title
changes without impacting the prop listing.title
.