<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.xxx-enter-active,.xxx-leave-active{
transition: opacity 1s;
}
.xxx-enter,.xxx-leave-to{
opacity: 0;
}
.move-enter-active{
transition: all 1s;
}
.move-leave-active{
transition: all 3s;
}
.move-enter,.move-leave-to{
opacity: 0;
transform: translateX(30px);
}
</style>
</head>
<body>
<div id="demo">
<button @click="isShow=!isShow">按钮</button>
<transition name="xxx" >
<p v-show="isShow" >hello</p>
</transition>
</div>
<div id="demo2">
<button @click="isShow=!isShow">按钮</button>
<transition name="move" >
<p v-show="isShow">hello</p>
</transition>
</div>
</body>
<script type="text/javascript" src="vue.js"></script>
<script type="text/javascript">
new Vue({
el:'#demo',
data(){
return{
isShow:true
}
},
// data:{
// isShow: true
// }
})
new Vue({
el:'#demo2',
data(){
return{
isShow:true
}
},
})
</script>
</html>
Vue动画
最新推荐文章于 2022-09-24 14:47:57 发布