默认情况下,控制 transition 样式的类名是以 'v-' 为前缀,我们可以自定义前缀名
动画前缀名.gif代码解析:
将前缀名改为'pretty'
<transition name="pretty">
<div class="img" v-if="flag">
<img :src="img" alt="" width="150">
</div>
</transition>
动画效果
.pretty-enter,
.pretty-leave-to {
opacity: 0;
transform: translateY(200px);
}
.pretty-enter-active,
.pretty-leave-active {
transition: all 1.5s ease;
}
网友评论