HTML events are things that happen to HTML elements. When Vue.js is used in HTML pages, it can react to these events.
In HTML, events can represent everything from basic user interactions to things happening in the rendering model.
These are some examples of HTML events:
A web page has finished loading
An input field was changed
A button was clicked
A form was submitted
The point of event handling is that you can do something whenever an event takes place.
In Vue.js, to listen to DOM events you can use the v-on
directive.
The v-on
directive attaches an event listener to an element. The type of the event is denoted by the argument, for example, v-on:keyup
listens to the keyup
event.
Note
The keyup
event occurs when the user releases a key. You can find a full list of HTML events at http://www.w3schools.com/tags/ref_eventattributes.asp.