/
交错列表.html
153 lines (149 loc) · 4.06 KB
/
交错列表.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!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>交错列表</title>
<style>
.pic {
width: 97%;
height: 120px;
margin: 20px 5px;
border-radius: 8px;
background: #CAE5E8;
}
.item {
margin: 5px;
padding: 0px;
overflow: hidden;
}
.item div {
display: inline;
float: left;
}
.flex {
display: flex;
justify-content: space-between
}
.card {
width: 65px;
height: 65px;
margin: 15px 12px;
margin-top: 0px;
border-radius: 8px;
background: #CAE5E8;
}
.item::after {
content: "";
clear: both;
display: block;
}
.square {
width: 20%;
height: 75px;
background: #CAE5E8;
border-radius: 8px;
}
.content {
width: 79%;
}
.content div {
margin: 15px;
margin-top: 0px;
padding: 0px;
width: 95%;
border-radius: 8px;
line-height: 30px;
background: #99D1D3;
}
.content div:last-child {
width: 65%;
background: #CAE5E8;
}
@keyframes one-in {
from {
padding-left: 100%;
height: 0;
}
to {
padding-left: 0%;
height: 100px;
}
}
@keyframes two-in {
from {
padding-right: 100%;
padding-top: 100px;
height: 0;
}
to {
padding-right: 0%;
padding-top: 0px;
height: 100px;
}
}
</style>
</head>
<body>
<div id="app">
<div class="pic"></div>
<div class="flex">
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
</div>
<transition-group
name="more"
v-bind:css="false"
v-on:before-enter="beforeEnter"
v-on:enter="enter"
>
<div class="item" v-for="item in arr" v-if="show3" v-bind:data-index="item" v-bind:key="item">
<div class="square"></div>
<div class="content">
<div> </div>
<div> </div>
</div>
</div>
</transition-group>
</div>
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
<script>
new Vue({
el: "#app",
data: {
show1: false,
show2: false,
show3: false,
arr: [1, 2, 3, 4, 5, 6, 7, 8]
},
methods: {
beforeEnter (el) {
el.style.opacity = 0
},
enter (el, done) {
// console.log(el.dataset.index)
let delay = el.dataset.index * 100
let animation = el.dataset.index % 2 === 0 ? 'one-in 0.4s infinite' : 'two-in 0.4s infinite'
setTimeout(()=>{
el.style.transition = 'opacity 0.4s '
el.style.opacity = 1
el.style.animation = animation
el.style['animation-iteration-count'] = 1
done()
}, delay)
}
},
mounted () {
setTimeout(()=>{
this.show1 = !this.show1
this.show2 = !this.show2
this.show3 = !this.show3
})
}
})
</script>
</body>
</html>