Skip to content

Commit c6596b6

Browse files
committed
Update demos
1 parent 9a8a499 commit c6596b6

File tree

12 files changed

+100
-41484
lines changed

12 files changed

+100
-41484
lines changed

demos/common/Corner.vue

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<template>
2+
<a v-bind:href="url" class="github-corner" aria-label="View source on GitHub">
3+
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0; z-index: 1000;" aria-hidden="true">
4+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
5+
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
6+
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
7+
</svg>
8+
</a>
9+
</template>
10+
11+
<script>
12+
export default {
13+
name: 'github-corner',
14+
15+
props: {
16+
path: String
17+
},
18+
19+
computed: {
20+
url () {
21+
return `https://github.com/tangbc/vue-virtual-scroll-list/tree/master/demos` + (this.path || '')
22+
}
23+
}
24+
}
25+
</script>
26+
27+
28+
<style>
29+
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
30+
</style>

demos/common/Item.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
<div class="index">#{{ index }}</div>
44
<div class="card">
55
<div class="card-avatar">
6-
<img class="card-avatar-img" v-bind:src="info.avatar" alt="AVATAR">
6+
{{ info.name.substr(0, 2) }}
7+
<!-- <img class="card-avatar-img" v-bind:src="info.avatar" alt="AVATAR"> -->
78
</div>
89
<div class="card-info">
910
<div class="card-info-item name">Name: {{ info.name }}</div>
1011
<div class="card-info-item email">Email: {{ info.email }}</div>
1112
</div>
13+
<div class="card-height">{{ this.height }}px</div>
1214
</div>
1315
</div>
1416
</template>
@@ -42,18 +44,29 @@ export default {
4244
.item {
4345
box-sizing: border-box;
4446
display: flex;
47+
// &:hover {
48+
// .card-height {
49+
// visibility: visible;
50+
// }
51+
// }
4552
.index {
4653
flex: 1;
4754
text-align: center;
4855
}
4956
.card {
57+
position: relative;
5058
flex: 4;
5159
display: flex;
5260
align-items: center;
5361
border-bottom: 1px dashed #a9a9a9;
5462
&-avatar {
5563
width: 40px;
5664
height: 40px;
65+
background: #ff6347;
66+
border-radius: 50%;
67+
text-align: center;
68+
line-height: 40px;
69+
color: #ffffff;
5770
&-img {
5871
display: block;
5972
width: 100%;
@@ -84,6 +97,13 @@ export default {
8497
}
8598
}
8699
}
100+
&-height {
101+
// visibility: hidden;
102+
position: absolute;
103+
right: 30px;
104+
font-style: italic;
105+
color: #d8bfd8;
106+
}
87107
}
88108
}
89109
</style>

demos/common/base.less renamed to demos/common/app.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
}
15
html,body {
26
height: 100%;
37
overflow: hidden;
@@ -6,6 +10,9 @@ html,body {
610
}
711
header {
812
font-family: monospace;
13+
h1 {
14+
padding: 20px 0;
15+
}
916
p {
1017
font-size: 14px;
1118
background: #f7f7f7;
@@ -17,6 +24,7 @@ header {
1724
.app {
1825
height: 100%;
1926
position: relative;
27+
z-index: 1;
2028
}
2129
.container {
2230
width: 520px;

demos/common/createApp.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Vue from 'vue'
2+
import GithubCorner from '../common/Corner.vue'
3+
4+
export default function (App) {
5+
Vue.config.devtools = false
6+
Vue.config.productionTip = false
7+
8+
Vue.component('GithubCorner', GithubCorner)
9+
10+
new Vue({
11+
render: (h) => h(App)
12+
}).$mount('#app')
13+
}

demos/frag-mode/App.vue

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<div class="app">
3+
<GithubCorner path="/frag-mode" />
34
<div class="container">
45
<header>
56
<h1>frag-mode</h1>
@@ -9,7 +10,6 @@
910
<virtual-list class="list"
1011
:size="size"
1112
:remain="remain"
12-
:bench="bench"
1313
>
1414
<item
1515
v-for="item in items"
@@ -30,9 +30,8 @@ import VirtualList from 'vue-virtual-scroll-list'
3030
import { getRandomUser } from '../common/util'
3131
3232
const remain = 6
33-
const bench = remain
3433
const itemSize = 80
35-
const itemCount = 1000 * 100
34+
const itemCount = 1000 * 10
3635
3736
let itemList = []
3837
for (let idx = 0; idx < itemCount; idx++) {
@@ -53,28 +52,14 @@ export default {
5352
5453
data () {
5554
return {
56-
bench,
5755
remain,
5856
size: itemSize,
5957
items: itemList
6058
}
61-
},
62-
63-
methods: {
64-
getItemProps (itemIndex) {
65-
const props = {
66-
height: itemSize,
67-
index: itemIndex,
68-
...getRandomUser()
69-
}
70-
return {
71-
props
72-
}
73-
}
7459
}
7560
}
7661
</script>
7762

7863
<style lang="less">
79-
@import '../common/base.less';
64+
@import '../common/app.less';
8065
</style>

0 commit comments

Comments
 (0)