© Brett Nelson 2018
Brett NelsonGetting to Know Vue.jshttps://doi.org/10.1007/978-1-4842-3781-6_5

5. Events

Brett Nelson1 
(1)
Eagan, Minnesota, USA
 

Being able to display lists of items and reuse portions of our markup is great for displaying things, but sometimes we want the user to do something and that is where events come in. In this chapter, we will learn about using listeners to wait for events, event handlers to take action when an event is called, and modifiers, which we can apply to events.

Listeners

Setting up event listeners in Vue is pretty straightforward. On the element from which you want to listen to events, add an attribute of v-on:eventName="handleEvent", where eventName is the name of the event you are interested in and handleEvent ...

Get Getting to Know Vue.js: Learn to Build Single Page Applications in Vue from Scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.