<template>
<div style="width:100px;height:100px;">
<div @click="show=!show">点击</div>
<transition name="transWords">
<div v-show="show">动画效果</div>
</transition>
</div>
</template>
<script>
export default {
data() {
return {
show:false
}
}
</script>
<style>
.transWords-enter{
opacity: 0.1;
background-color: green;
}
.transWords-enter-active{
transition: all 3s linear;
}
.transWords-enter-to{
opacity: 0.7;
background-color: red;
font-size: 50px;
}
.transWords-leave{
opacity: 0.9;
background-color: red;
}
.transWords-leave-active{
transition: all 3s linear;
}
.transWords-leave-to{
opacity: 0.1;
background-color: palegreen;
font-size: 20px;
}
</style>
transition vue动画,过渡动画
最新推荐文章于 2024-07-20 18:05:54 发布