может быть не одно из самых лучших решений, но рабочее
дочерний:
<div @click="choice(item)" v-for="item in items" :key="item.id">
</div>
data: () => ({
show: false,
amount: null,
choiceUserColor: "",
choiceUserImg: "",
choiceUserNumder: 0,
}),
methods: {
this.choiceUserColor = item.title
this.choiceUserImg = item.img
this.choiceUserNumder = item.number
console.log(this.choiceUserColor, this.choiceUserImg, this.choiceUserNumder)
this.$emit('choiceUser', [this.choiceUserColor, this.choiceUserImg, this.choiceUserNumder])
},
methodClose() {
this.show = false
}
}
Родитель:
<modal-palette @choiceUser="adaa" :items="items" :name="name" ref="modal"/>
data: () => ({
UserColor: "Violet",
UserImg: "/temp/card-bg-12.svg",
UserNumder: 522,
}),
methods: {
adaa(args) {
this.args = args
this.UserColor = this.args[0]
this.UserImg = this.args[1]
this.UserNumder = this.args[2]
console.log(args)
},
openModal() {
this.$refs.modal.show = true
},
}