Complete the code to wrap the element with a Vue transition component.
<template> <[1] name="fade"> <p v-if="show">Hello Vue!</p> </[1]> </template>
div instead of transition.The <transition> component in Vue wraps elements to apply animations when they enter or leave the DOM.
Complete the code to bind the show state to the transition element.
<template> <transition name="fade"> <p v-if="[1]">Hello Vue!</p> </transition> </template>
visible or display.The v-if directive uses the show data property to control visibility.
Fix the error in the CSS class for the enter transition.
<style>
.fade-enter-active {
transition: opacity [1] ease;
}
.fade-enter-from {
opacity: 0;
}
.fade-enter-to {
opacity: 1;
}
</style>The transition duration should be a time value like 2s for 2 seconds.
Fill both blanks to create a fade-out transition with 1.5 seconds duration.
<style>
.fade-leave-active {
transition: opacity [1] ease;
}
.fade-leave-from {
opacity: 1;
}
.fade-leave-to {
opacity: [2];
}
</style>The fade-out transition changes opacity from 1 to 0 over 1.5 seconds.
Fill all three blanks to create a JavaScript hook for the transition that logs when the element enters.
<script setup>
function beforeEnter(el) {
console.log('[1]');
}
function enter(el, done) {
el.style.opacity = '[2]';
setTimeout(() => {
el.style.opacity = '[3]';
done();
}, 300);
}
</script>The beforeEnter hook logs a message. The enter hook sets opacity from 0 to 1 to fade in.