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

5. Events

Brett Nelson1 
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.


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.