Newer
Older
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
<!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>vdynamic-list demo</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<div id="app">
<div class="entry header">
<div>
<div>Name</div>
<div>Email</div>
<div>Notes</div>
<div class="filler"></div>
</div>
</div>
<dynamic-list ref="myList">
<template slot="entry" slot-scope="props">
<div>{{props.entry.name}}</div>
<div>{{props.entry.email}}</div>
<div>{{props.entry.notes}}</div>
<div class="filler"></div>
</template>
<template slot="unloaded" slot-scope="props">
<div><div></div></div>
<div><div></div></div>
<div><div></div></div>
<div class="filler"></div>
</template>
</dynamic-list>
</div>
</body>
<script src="index.js"></script>
<script>
const app = new Vue({
el: '#app'
});
new vDynamicList(app, {
ref: 'myList',
onLoad: (i, l) => {
return new Promise((resolve, reject) => {
let y = [];
for (let j=0;j<l;j++) y.push({name: 'test', email: 'eee', notes: i * l + j});
setTimeout(() => resolve(y), 400);
});
},
elements: 1400,
limit: 100
});
</script>
<style>
html {
font-family: 'Raleway', sans-serif;
}
@keyframes color {
0% {
background-color: #22222222;
}
50% {
background-color: #44444444;
}
100% {
background-color: #22222222;
}
}
.header {
font-size: 1.8em;
}
.header div div {
margin-left: 14px;
margin-top: 4px;
}
min-height: calc(50px * 100);
}
.entry {
height: 50px;
}
.entry > div {
width: 100%;
}
.entry:hover {
background-color: rgba(150, 150, 150, 0.3);
}
.entry > div {
display: flex;
flex-direction: row;
}
.entry > div div:nth-child(1) {
flex: 2;
}
.entry > div div:nth-child(2) {
flex: 2;
}
.entry > div div:nth-child(3) {
flex: 4;
}
.entry > div div.filler {