参照vue.js官网
<transition-group name="box">
这里放input等组件
transition-group>
<style>
/*定义离开过渡的开始状态*/
.box-leave{
opacity: 1;
height: 40px;
}
.box-leave-active{
/* transition: height .5s ease; */
/* animation: bounce-in .5s reverse; */
transition: all .5s ;
animation: bounce-out .5s ;
/* transition: all 10s ease; */
}
/*2.1.8 版及以上定义离开过渡的结束状态*/
.box-leave-to{
opacity: 0;
height: 0px;
/* animation: bounce-in .5s reverse; */
}
/* 定义进入过渡的开始状态 */
.box-enter {
opacity: 0;
height: 0;
/* animation: bounce-in .5s reverse; */
}
/* 定义进入过渡生效时的状态 */
.box-enter-active {
transition: height .5s ;
animation: bounce-in .5s;
}
/* 2.1.8 版及以上定义进入过渡的结束状态 */
.box-enter-to {
opacity: 1;
height: 40px;
}
@keyframes bounce-in {
0% {
transform: scale(0);
/* transform: rotateX(0deg); */
}
100% {
transform: scale(1);
/* transform: rotateX(90deg); */
}
}
@keyframes bounce-out {
0% {
transform: scale(1);
/* transform: rotateX(0deg); */
}
100% {
transform: scale(0);
/* transform: rotateX(90deg); */
}
}
style>