按钮
//css
.v-d{
width:50px;
height:50px;
padding:10px;
transition:all0.4slinear
}
.v-d.in{
width:30px;
height:30px;
background:#000;
transition:all0.4slinear
}
.move-enter-active,.move-leave-active{
transition:all0.4slinear
}
.move-enter,.move-leave-active{
opacity:0;
transform:translateX(30px);
}
.move-enter,.move-leave-active.in{
transform:rotate(45deg)
}
//js
window.onload=function(){
newVue({
el:'#demo',
data:{
show:false
}
})
}

运行代码后发现这个类名的过渡:

.move-enter,.move-leave-active.in{
transform:rotate(180deg)
}

没起作用,我开始以为这种嵌套的写法不支持,但是后来经过多次尝试后发现,原来transition应用的类名不能和基本样的类名一样,也就是.in这个类必须换名才能起作用,所以在改动下面代码:







.move-enter,.move-leave-active.in_move{
transform:rotate(180deg)
}

改完运行就ok了,实现了元素旋转和位移。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。

热门推荐

免责声明:网站资源来源于网络,如有侵权,请及时联系删除。

Copyright © 2024 好资源导航网. All Rights Reserved.

蜀ICP备2021004611号-4 网站地图