0👍
Inside PlusIconComponent
, in your clickHandler
method, you should emit some event to component’s parent passaing arguments, like:
clickHandler(){
this.$emit('clicked', this.part)
}
On the other hand, in your parent you should catch this event with another handler, which has the same name emited by the child:
<PlusIconComponent :key="part" v-for="part in parts" :part="part" :gender="gender" :opened="(showPart===part)" @clicked="parentsHandler" />
Finally, you can implement what you want in the parent:
parentsHandler(part) {
console.log('parent says: ', part)
}
That is the way child component comunicates with its parents. More information here
- [Vuejs]-Vue sort object key values descending by english string number
- [Vuejs]-How can search through json data in vue?
Source:stackexchange.com