<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="./animate.min.css" />
<script src="./vue.js"></script>
<style>
.box {
width: 100px;
height: 100px;
background-color: red;
}
.custom-enter-active {
animation-name: zoomIn;
animation-duration: 10s;
}
.custom-leave-active {
animation-name: zoomOut;
animation-duration: 2s;
}
</style>
</head>
<body>
<div id="app">
<input type="checkbox" v-model="show" />显示/隐藏
<hr />
<!-- 方式一: 使用自定义过渡名 -->
<transition
enter-active-class="animate__zoomIn"
leave-active-class="animate__zoomOut"
>
<div class="box animate__animated" v-show="show"></div>
</transition>
<br />
<br />
<br />
<!-- 方式二: 使用自定义过渡名 -->
<transition name="custom">
<div class="box animate__animated" v-show="show"></div>
</transition>
</div>
<script>
let vm = new Vue({
el: "#app",
data: {
show: true,
},
});
</script>
</body>
</html>