How it works...

Running the preceding code will install an event handler on the button. The syntax is v-on:DOMevent="methodEventHandler". The handler must be a method, that is, a function in the methods option. In the preceding example, toast is the handler.

Get Vue.js 2 Cookbook 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.