Skip to Content
Vue.js 2 Cookbook
book

Vue.js 2 Cookbook

by Andrea Passaglia
April 2017
Intermediate to advanced
454 pages
12h 51m
English
Packt Publishing
Content preview from Vue.js 2 Cookbook

How it works...

When we wrote the two elements, we used the key attribute specifying who is the frog and who is the princess. This is because, Vue optimization system will kick in otherwise. It will see that the content of the two elements can be swapped without swapping the elements themselves and no transition will ensue since the element was the same and only the content changed.

If we remove the key attribute, we can see for ourselves that the frog and the princess will change, but without any transition:

<transition name="fade">   <p v-if="kisses < 3">frog</p>   <p v-if="kisses >= 3">princess</p> </transition>

Consider that we use two ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Vue.js 2

Learning Vue.js 2

Olga Filipova
Pro Vue.js 2

Pro Vue.js 2

Adam Freeman

Publisher Resources

ISBN: 9781786468093Supplemental Content