Skip to content

Commit 58c8913

Browse files
committed
Add variable mode demo.
1 parent 990dc4e commit 58c8913

File tree

13 files changed

+63325
-25
lines changed

13 files changed

+63325
-25
lines changed

demos/common/Corner.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<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">
3+
<svg v-bind:width="size" v-bind:height="size" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0; z-index: 1000;" aria-hidden="true">
44
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
55
<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>
66
<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>
@@ -9,13 +9,21 @@
99
</template>
1010

1111
<script>
12+
import { isMobile } from './util'
13+
1214
export default {
1315
name: 'github-corner',
1416
1517
props: {
1618
path: String
1719
},
1820
21+
data () {
22+
return {
23+
size: isMobile ? 40 : 80
24+
}
25+
},
26+
1927
computed: {
2028
url () {
2129
return `https://github.com/tangbc/vue-virtual-scroll-list/tree/master/demos` + (this.path || '')

demos/common/Item.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<img v-else class="card-avatar-img" v-bind:src="info.avatar" alt="AVATAR">
1111
</div>
1212
<div class="card-info">
13-
<div class="card-info-item name">Name: {{ info.name }}</div>
13+
<div class="card-info-item name">{{ info.name }}</div>
1414
<div class="card-info-item time">Birthday: {{ info.time }}</div>
1515
</div>
16-
<div class="card-height">{{ this.height }}px</div>
16+
<div class="card-height" v-if="variable">{{ height }}px</div>
1717
</div>
1818
</div>
1919
</template>
@@ -27,11 +27,12 @@ export default {
2727
props: {
2828
height: Number,
2929
index: Number,
30+
variable: Boolean,
3031
info: {
3132
name: String,
3233
time: String,
3334
avatar: String,
34-
color: String
35+
color: String,
3536
}
3637
},
3738
@@ -69,7 +70,7 @@ export default {
6970
display: flex;
7071
-webkit-user-select: none;
7172
user-select: none;
72-
&:active, &:hover {
73+
&:hover {
7374
background-color: #f0f8ff;
7475
}
7576
.index {
@@ -82,7 +83,7 @@ export default {
8283
display: flex;
8384
align-items: center;
8485
border-bottom: 1px dashed #cecece;
85-
@media (max-width: 640px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
86+
@media (max-width: 640px) and (-webkit-min-device-pixel-ratio: 2) {
8687
border-bottom: 0.5px solid #cccccc;
8788
}
8889
&-avatar {
@@ -107,7 +108,7 @@ export default {
107108
&-info {
108109
display: flex;
109110
flex-direction: column;
110-
height: 100%;
111+
// height: 100%;
111112
padding-left: 20px;
112113
&-item {
113114
flex: 1;
@@ -122,10 +123,10 @@ export default {
122123
max-width: 180px;
123124
}
124125
&.name {
125-
top: 25%;
126+
padding-bottom: 3px;
126127
}
127128
&.time {
128-
top: 5%;
129+
padding-top: 3px;
129130
color: #a9a9a9;
130131
}
131132
}
@@ -134,9 +135,12 @@ export default {
134135
position: absolute;
135136
right: 30px;
136137
font-style: italic;
137-
color: #d8bfd8;
138+
color: #999;
139+
font-weight: 100;
140+
font-family: sans-serif;
141+
font-size: 12px;
138142
@media (max-width: 375px) {
139-
visibility: hidden;
143+
right: 10px;
140144
}
141145
}
142146
}

demos/common/app.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ header {
1414
padding: 20px 0;
1515
@media (max-width: 640px) {
1616
padding: 10px 0;
17+
font-size: 24px;
1718
}
1819
}
1920
p {
@@ -42,7 +43,7 @@ header {
4243
.main {
4344
padding: 5px;
4445
border-radius: 3px;
45-
background-color: #4682b4;
46+
background-color: #66cdaa;
4647
@media (max-width: 640px) {
4748
padding: 3px;
4849
}

demos/common/util.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ export const getRandomUser = () => {
185185
}
186186
}
187187

188+
export const getRandomHeight = () => Random.pick([40, 50, 80, 100, 140, 180])
189+
188190
export const getQuery = (query) => {
189191
try {
190192
return new URLSearchParams(window.location.search).get(query)

0 commit comments

Comments
 (0)