I followed the Vue animation instructions from the documentation carefully:
- The
transition
component has aname="fade"
attribute. v-if
is placed in the child of thetransition
element.- The styles were directly copied from the documentation provided.
new Vue({
el: '#app',
template: `
<transition name="fade">
<div
class="NotificationBar"
v-if="show"
:class="{
NotificationBar__Success: currentNotificationType === notificationBarTypes.success
}"
@click="show = !show"
>
<div class="NotificationBar-Centerer">
<svg class="NotificationBar-Icon-SvgCanvas" viewBox="0 0 24 24">
<path class="NotificationBar-Icon-SvgPath" v-if="currentNotificationType === notificationBarTypes.success" d="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22C17.5s7-4.5l-1 3zuneigeSEslkjfnAlrekjhewjUWIE8ALSDKHJGAw9eiawkfAIWEHhQUDqWIUEWGOWHEGIERNalksjdflkweOIREkJNALKjerwieORGkwrltouNoierljwoFIUVNWnNaumiueRFNAIWRHLERincvOIARNenNYFDNBVeFWIOFEFM92232NDFnekFNE122343mnewifie98292039e02930encmfIJURFBNDVJKHDVNVIhnvdVKzhdfZinPIQRfneorfun98EH83742OKJSKgnsldkFn89EUBOAUFbna98ETHadODNSHle84732892LKEGETeygrUYDaosifSDKDIRSNLMcaidWDGfsBCAiufuisDHGstu78TDGHudsocyutegusbSportssSPORTSfootballFOOTBALLllawokskdslksdosasePOspinMOVIE895uoSFHuoo82ojmsnmoviemoviesELINKLNlsnkllokosereLTourTLECyclonesyBASKETLLAMA894823789217637891923nba88932749182179dasodmnoplaygd37583ncmcobackyardayugcfoeb");
To add to the experiment, I set the duration for the styles to be 10 seconds:
.fade-enter-active, .fade-leave-active {
transition: opacity 10s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
However, I noticed that the animation appears to happen instantly, with no transition effect (duration seems to be 0s).
If you'd like to see a demonstration, please visit the JSFiddle link for a working example.