0👍
If selectedSuppliers
is an array of object, then the spread operator only performs a shallow copy of this array. It means that updating any object of suppliers
will update the content of selectedSuppliers
.
You can take a look at this short post.
0👍
This might work,
props: {
selectedSuppliers: {
type: Array,
required: true
},
},
data () {
return {
selected: this.selectedSuppliers.map(o => Object.assign({}, o)
}
}
- [Vuejs]-Change only the color of the button clicked and the others return to the original color VueJS
- [Vuejs]-Vue: Event does not emit several values. Is there something wrong with v-model?
Source:stackexchange.com