Vue动画--使用 animate.css库

code:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>使用 animate.css库</title>
		<script type="text/javascript" src="js/vue.js" ></script>
		<!--自定义类名操作-->
		<!--<style>
			.active{
				transform-origin: left center;
				animation: bounce-in 1s;
			}
			
			.leave{
				transform-origin: left center;
				animation: bounce-in 1s reverse;
			}
		</style>-->
		<!--使用 animate.css库-->
		<link rel="stylesheet" href="css/animate.css" />
	</head>
	<body>
		<div id="root">
			<!--自定义类名操作
			<transition
				enter-active-class="active"
				leave-active-class="leave"
				>
				<div v-if="show">hello world</div>
			</transition>-->
			<!--使用 animate.css库-->
			<transition
				enter-active-class="animated swing"
				leave-active-class="animated shake"
				>
				<div v-if="show">hello world</div>
				</transition>
			<button @click="handleClick">切换</button>
		</div>
		<script>
			new Vue({
				el:"#root",
				data:{
					show:true
				},
				methods:{
					handleClick(){
						this.show=!this.show
					}
				}
			})
		</script>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/AsaZyf/article/details/83751175