Scaling UpLesson 23Free preview
Vue $emit()
This lesson is part of Vue · All levels
Summary
The $emit method is used by the child component to emit custom events to the parent, so that the data stream remains one direction from the parent to the child and vice versa through the event. The mother listens to the incident with the directive v-on or the abbreviation @. This pattern became the standard way of managing two-way communication between components without creating fragile coupling.
Key points
- The kid broadcasts the incident with this. $emit or emit on setup.
- The mother listened to the customary events with the syntax of the name @Genesis.
- Additional data can be sent as a second argument to the $emit.
- This pattern keeps the data flowing one way, the event flowing upwards.
- The name of the event is usually written in chapters on the template.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.