appear无法显示

来源:5-3 在Vue中同时使用过渡和动画

慕勒2563729

2018-05-23

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>5-3Vue中同時使用過度和動畫</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	<link rel="stylesheet" type="text/css" href="./animate.css">
<body>
	<div id="root">
		<transition 
			name="fade" 
			appear 
			enter-active-class="animated slideOutDown" 
			leave-active-class="animated hinge" 
			appear-active-class="animated swing"
		>
				<div v-show="show">zheng</div>
		</transition>
		<button @click="clickHandl">uuij</button>

	</div>

</body>
		<script type="text/javascript">
	
			var vm = new Vue({
				el: "#root",
				data:{
					show:false
				},
				methods: {
					clickHandl: function(){
						this.show = !this.show;
					}
				}
			})
		</script>
</html>


写回答

1回答

慕婉清0298927

2018-05-26

appear-active-class和enter-active-class必须使用同一种动画

这里把代码改成

<transition 

            name="fade" 

            appear 

            enter-active-class="animated slideOutDown" 

            leave-active-class="animated hinge" 

            appear-active-class="animated slideOutDown"

        >

或者

<transition 

            name="fade" 

            appear 

            enter-active-class="animated swing" 

            leave-active-class="animated hinge" 

            appear-active-class="animated swing"

        >

就可以了

0
0

Vue2.5-2.6-3.0开发去哪儿网App 零基础入门到实战

课程紧跟Vue3版本迭代,企业主流版本Vue2+Vue3全掌握

10675 学习 · 8191 问题

查看课程