一 vue的过渡 实现多物体运动
使用 animate.css库
下载 bower install animate.css
多元素 多物体运动 使用 transition-group 其子元素加属性key
案例
<!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>
<style>
#box {
width: 100px;
height: 100px;
background-color: red;
}
</style>
<body>
<div id="app">
<button @click="show=!show">按钮</button>
<transition-group enter-active-class="animated zoomInLeft" leave-active-class="animated zoomOutRight">
<div id="box" v-show="show" :key="1"></div>
<div id="box" v-show="show" :key="2"></div>
</transition-group>
</div>
<script src="../vue.js"></script>
<script>
new Vue({
el: "#app",
data: {
show: true,
},
methods: {
}
})
</script>
</body>
</html>