<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="animate.css">
</head>
<body>
<div id="app">
<!-- transition有6个特殊属性, 可以让我们自定义类名, 主要是配合第三方类库使用 -->
<transition enter-active-class="animated bounce" leave-active-class="animated lightSpeedOut">
<p v-if="isShow">我想买房子</p>
</transition>
<transition enter-active-class="animated lightSpeedIn" leave-active-class="animated lightSpeedOut">
<p v-if="isShow">另外还想要辆车</p>
</transition>
<button @click='change'>显示隐藏</button>
</div>
<script src="vue.js"></script>
<script>
new Vue({
el: '#app',
data: { isShow: true },
methods: {
change() {
this.isShow = !this.isShow;
}
}
});
</script>
</body>
</html>
网友评论