Skip to content

Commit 9d9fa5c

Browse files
committed
Add without-virtual-list to compare experience.
1 parent a956917 commit 9d9fa5c

File tree

9 files changed

+122
-10
lines changed

9 files changed

+122
-10
lines changed

demos/common/Header.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
2-
<header>
2+
<header v-bind:class="warning ? 'warning': ''">
33
<h1>{{ title }}</h1>
44
<section>
5-
<span>{{ desciption }}</span>
6-
<span class="memory" v-if="supportMemory">Memory used: {{memoryUsed}} MB.</span>
7-
<div class="icon" v-bind:class="showSetting ? 'active' : ''" v-on:click="clickIcon">
5+
<span class="desciption">{{ desciption }}</span>
6+
<span class="memory" v-if="supportMemory && isRenderSetting">Memory used: {{memoryUsed}} MB.</span>
7+
<div class="icon" v-if="isRenderSetting" v-bind:class="showSetting ? 'active' : ''" v-on:click="clickIcon">
88
<svg width="25" height="25" t="1553394278598" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8690" xmlns:xlink="http://www.w3.org/1999/xlink">
99
<path d="M809.21 474.749H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966H809.21c19.865 0 35.966-16.107 35.966-35.966 0-19.864-16.101-35.966-35.966-35.966m0 215.796H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966H809.21c19.865 0 35.966-16.107 35.966-35.966 0-19.865-16.101-35.966-35.966-35.966M220.52 258.954c-19.865 0-35.966 16.101-35.966 35.966 0 19.865 16.101 35.966 35.966 35.966s35.966-16.101 35.966-35.966c0-19.865-16.102-35.966-35.966-35.966m153.502 71.932H809.21c19.865 0 35.966-16.101 35.966-35.966 0-19.865-16.101-35.966-35.966-35.966H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.864 16.102 35.966 35.966 35.966M220.52 474.749c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966s35.966-16.107 35.966-35.966c0-19.864-16.102-35.966-35.966-35.966m0 215.796c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966s35.966-16.107 35.966-35.966c0-19.865-16.102-35.966-35.966-35.966" p-id="8691" fill="#2c2c2c"></path>
1010
</svg>
@@ -51,6 +51,7 @@ export default {
5151
},
5252
5353
props: {
54+
warning: Boolean,
5455
title: String,
5556
desciption: String,
5657
startIndex: Number,
@@ -166,4 +167,9 @@ header {
166167
}
167168
}
168169
}
170+
header.warning {
171+
h1 {
172+
color: #ffc107;
173+
}
174+
}
169175
</style>

demos/item-mode/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/variable-height/build.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/vfor-mode/build.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/webpack.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ module.exports = multiConfigs.map((config) => {
2929

3030
watch: !isProduction,
3131

32+
performance: {
33+
hints: false
34+
},
35+
3236
mode: isProduction ? 'production' : 'development',
3337

3438
resolve: {

demos/without-virtual-list/App.vue

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<div class="app">
3+
<div class="container">
4+
<Header
5+
:warning="true"
6+
title="without-virtual-list"
7+
:desciption="'Build ' + itemCount.toLocaleString() + ' full items, without using virtual list.'"
8+
></Header>
9+
<div class="main">
10+
<div class="list" :style="rootStyle">
11+
<div>
12+
<item
13+
v-for="item in items"
14+
v-bind:key="item.index"
15+
:index="item.index"
16+
:height="size"
17+
:info="item.info"
18+
/>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
</div>
24+
</template>
25+
26+
<script>
27+
import Item from '../common/Item.vue'
28+
import { getRandomUser } from '../common/util'
29+
30+
const remain = 6
31+
const itemSize = 80
32+
const itemCount = 1000 * 10
33+
34+
let itemList = []
35+
for (let idx = 0; idx < itemCount; idx++) {
36+
itemList.push({
37+
index: idx,
38+
height: itemSize,
39+
info: getRandomUser()
40+
})
41+
}
42+
43+
export default {
44+
name: 'app',
45+
46+
components: {
47+
'item': Item
48+
},
49+
50+
data () {
51+
return {
52+
remain,
53+
itemCount,
54+
size: itemSize,
55+
items: itemList
56+
}
57+
},
58+
59+
computed: {
60+
rootStyle () {
61+
return {
62+
'display': 'block',
63+
'overflow-y': 'auto',
64+
'height': this.remain * this.size + 'px'
65+
}
66+
}
67+
}
68+
}
69+
</script>
70+
71+
<style lang="less">
72+
@import '../common/app.less';
73+
</style>

demos/without-virtual-list/build.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/without-virtual-list/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>without use virtual-list</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script src="build.js"></script>
11+
</body>
12+
</html>

demos/without-virtual-list/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import App from './App.vue'
2+
import createApp from '../common/createApp'
3+
4+
createApp(App)

0 commit comments

Comments
 (0)