過渡效果html
<style>vue
.xxxx-enter-active, // 顯示過渡ide
.xxxx-leave-active { // 隱藏過渡動畫
transition: all 1s;ui
}spa
// 指定隱藏時 的樣式code
.xxxx-enter, // 指定過渡orm
.xxxx-leave-to { // 指定過渡htm
opacity: 0;blog
transform: translateX(50px);
}
</style>
------------------------------------------------------------------
<div id="test">
<button @click="isShow=!isShow">切換</button>
<transition name="xxxx">
<p v-show="isShow">哈哈</p>
</transition>
</div>
<style>
.dada-enter-active { animation: 1s dada; } .dada-leave-active { animation: 2s dada reverse; } @keyframes dada { 0% { transform: translateX(40px); } 50% { transform: translateX(80px); } 100% { transform: translateX(0px); } }
</style>
<div id="test">
<transition name="dada"> <p v-show="isShow">大大</p> </transition>
</div>