0
0
Vueframework~5 mins

Enter and leave transitions in Vue - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of <transition> in Vue?
The <transition> component in Vue wraps elements or components to apply enter and leave animations when they appear or disappear from the DOM.
Click to reveal answer
intermediate
Name the CSS classes Vue automatically applies during an enter transition.
Vue applies these classes in order: v-enter-from, v-enter-active, and v-enter-to to control the start, active, and end states of the enter animation.
Click to reveal answer
beginner
How do you trigger a leave transition in Vue?
A leave transition happens when a condition controlling the element/component becomes false and Vue removes it from the DOM, applying v-leave-from, v-leave-active, and v-leave-to classes for animation.
Click to reveal answer
intermediate
What role does the appear attribute play in Vue transitions?
Adding the appear attribute to a <transition> makes Vue apply enter transition classes when the element first renders, not just on later insertions.
Click to reveal answer
advanced
How can you customize transition class names in Vue?
You can set custom class names using props like <code>enter-from-class</code>, <code>enter-active-class</code>, <code>leave-to-class</code>, etc., on the <code>&lt;transition&gt;</code> component.
Click to reveal answer
Which Vue component is used to add enter and leave animations?
A<effect>
B<animate>
C<motion>
D<transition>
What class does Vue apply at the start of an element's enter transition?
Av-enter-from
Bv-leave-to
Cv-enter-active
Dv-leave-from
When does a leave transition occur in Vue?
AWhen the page loads
BWhen an element is added to the DOM
CWhen an element is removed from the DOM
DWhen a component is mounted
What does the appear attribute do in a Vue transition?
ATriggers enter animation on initial render
BDisables all animations
CMakes leave animations faster
DRepeats the animation infinitely
How can you change the default transition class names in Vue?
ABy adding classes to the parent element
BBy setting props like enter-from-class on <transition>
CBy using inline styles only
DBy editing Vue source code
Explain how Vue uses CSS classes to animate an element entering and leaving the DOM.
Think about the start, active, and end states of animations.
You got /4 concepts.
    Describe how you would add a fade-in effect when a component first appears using Vue transitions.
    Focus on the appear attribute and CSS opacity.
    You got /3 concepts.