Vue TutorialLesson 11Free preview
Vue Event Modifiers
This lesson is part of Vue · All levels
Summary
An event modifier is a punctuated ending that modifies the listener's behavior without the need to write additional code. Example generally prevent to call preventDefault and stop to call stopPropagation. Modifiers can be sorted in a sequence such as @click.stop.prevent, and keyboard and mouse modifiers such as enter and self are also available.
Key points
- Modifiers are written with a dot after the event name, for example @click.prevent.
- It calls for preventDefault, it calls for stopPropagation.
- Some modifications can be combined, for example @click.stop.prevent.
- Only run the handler when the event originates from the element itself.
- Keyboard modifiers (P0}}, .esc) and mouse (P2}}, .capture) are available. (.enter)
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.