-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy path02 dynamic binding transitions.html
98 lines (88 loc) · 2.12 KB
/
02 dynamic binding transitions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>02</title>
<script src="vue.js"></script>
<style>
/* 必需 */
.expand-transition {
transition: all .3s ease;
/* 所有设定,0.3秒*/
height: 30px;
padding: 10px;
color: #000000;
background-color: #eee;
/* 背景 灰色 */
overflow: hidden;
}
/* .expand-enter 定义进入的开始状态 */
/* .expand-leave 定义离开的结束状态 */
.expand-enter,
.expand-leave {
height: 0;
padding: 0 10px;
opacity: 0;
/* 透明度 */
}
/* 必需 */
.fade-transition {
opacity: 1;
height: 30px;
padding: 10px;
color: #ffffff;
background-color: #3636ff;
transition: opacity 1.25s ease-in-out;
-moz-transition: opacity 1.25s ease-in-out;
-webkit-transition: opacity 1.25s ease-in-out;
}
.fade-enter,
.fade-leave {
opacity: 0.1;
}
#menu ul {
float: right;
list-style: none;
}
#menu ul li {
float: left;
margin: 0px 10px 0px 0px;
}
</style>
</head>
<body>
<div id="example">
<ul>
<li>
<div v-if="show" :transition="transitionName">hello</div>
</li>
</li> {{$data|json}}</li>
</ul>
<ul id="menu">
<li>
<button @click="show=!show">显示 :{{show}} , 过渡效果 {{transitionName}}</button>
</li>
<li>
<button @click="transitionName_set_to('fade')">过渡效果 fade</button>
</li>
<li>
<button @click="transitionName_set_to('expand')">过渡效果 expand</button>
</ul>
</div>
</div>
<script>
var vm = new Vue({
el: '#example',
data: {
show: true,
transitionName: 'expand'
},
methods: {
transitionName_set_to: function(to1) {
this.transitionName = to1;
}
}
})
</script>
</body>
</html>