O'Reilly logo

Getting to Know Vue.js: Learn to Build Single Page Applications in Vue from Scratch by Brett Nelson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required