How to do it...

We will build an interface for a taxi company (similar to the preceding recipe) that will enable users to call a taxi at the click of a button and will provide a nice animated feedback when the taxi is called.

To code the button, write the following HTML:

<div id="app">   <button @click="taxiCalled = true">     Call a cab   </button>   <p v-if="taxiCalled"></p> </div>

Then, you initialize the taxiCalled variable to false, as shown in the following JavaScript:

new Vue({   el: '#app',   data: {     taxiCalled: false   } })

At this point, we will create our own custom transition in CSS:

.slideInRight {  transform: translateX(200px);  ...

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.