其实vue主要就是enter-active-class 和 leave-active-class,直接配合animated.css使用非常好
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/animate.css" />
<style type="text/css">
#box {
width: 100px;
height: 100px;
background: lightblue;
}
</style>
<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="app">
<button class="btn btn-primary" @click="show = !show">按钮</button>
<transition enter-active-class="zoomInRight" leave-active-class="zoomOutRight">
<div id="box" v-show="show" class="animated">789</div>
</transition>
</div>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
show: false
},
methods: {
toggle() {
this.show = !this.show;
}
}
})
</script>
</body>
</html>