There's more...

To reach this "second page" I was talking about, just click on the submit button. This is the default behavior and, in our case it's not what we want; since we usually don't like having to change page when dealing with Vue, I will show you how to prevent it.

Modern websites tend to give feedback for your action on the same page, sometimes without interrupting your workflow (what if you want to clone another five or six creatures in the same session?)

Let's turn it into something more useful. First of all, we have to prevent the button default action, which is to change page; for this, we use the prevent modifier:

<input type="submit" value="Print now" @click.prevent="printHandler"/>

The printHandler will be a method in our ...

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.