Background: Vue ES6, the child component is called after the parent component is created, and the event trigger onclick has been encapsulated in the underlying component (the child component of the child component)
Question: How does a child component pass parameters to the parent component when there is no event binding in the parent component?
EventBus (a situation without event binding that does not quite meet the requirements of the question)
Vuex
dispatch
Father-child component communication
$emit()
The child component uses v-on to listen to an event, and then when it is triggered, it sends the event, which is $emit. Then the parent component also uses v-on to listen to the event you send, and then executes the event defined by your parent component.
The person above has made it clear, I’m here to make up for it
child.vue
parent.vue
$emit()
Subcomponent this.$emit("event",data)
Parent component @event