<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>在Vue中同时使用过渡和动画</title>
<script src="js/vue.js"></script>
<link rel="stylesheet" href="css/demo.css">
<link rel="stylesheet" href="css/animate.css">
<style>
.fades-enter,.fades-leave-to{
opacity: 0;
}
.fades-enter-active,
.fades-leave-active{
transition: opacity 3s;
}
</style>
</head>
<body>
<div id="app">
<transition
:duration='{enter:5000,leave:10000}'
appear
name="fades"
enter-active-class="animated swing fades-enter-active"
leave-active-class="animated zoomInUp fades-leave-active"
appear-active-class="animated swing">
<div v-if="seen">hello world</div>
</transition>
<button @click="handleClick">切换</button>
</div>
<script>
new Vue({
el:'#app',
data:{
seen:true
},
methods:{
handleClick:function () {
this.seen=!this.seen
}
}
})
</script>
</body>
</html>
网友评论