Skip to content

Commit 18e0d91

Browse files
committed
Update new demos folder.
1 parent d7334ce commit 18e0d91

32 files changed

+13173
-61928
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dev
22
node_modules
33
npm-debug.log
4-
examples/**/*.map
4+
demos/dev/
5+
demos/**/*.map

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
##
1515

16-
*If you are looking for a vue component which support big data list with high scroll performance, now you are in the right place!*
16+
*If you are looking for a vue component which support big amount data list with high scroll performance, now you are in the right place!*
1717

1818
* [Advantages](#advantages)
1919
* [Live demos](#live-demos)

demos/list/App.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
1234
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'app',
10+
11+
data () {
12+
return {
13+
}
14+
}
15+
}
16+
</script>
17+
18+
<style>
19+
div {
20+
padding: 0;
21+
background: red;
22+
}
23+
</style>
24+

examples/build/finite.js renamed to demos/list/build.js

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

demos/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>Vue virtual scroll list</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script src="build.js"></script>
11+
</body>
12+
</html>

demos/list/main.js

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

demos/webpack.conf.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const path = require('path')
2+
const { lstatSync, readdirSync } = require('fs')
3+
const VueLoaderPlugin = require('vue-loader/lib/plugin')
4+
5+
const isDirectory = source => lstatSync(source).isDirectory()
6+
const getDirectories = source => readdirSync(source).map((name) => path.join(source, name)).filter(isDirectory)
7+
const demoDirectorys = getDirectories('demos').map((demo) => demo.split('/').pop())
8+
9+
console.log('\x1b[36m', `Building demos: [${demoDirectorys.join(', ')}].` ,'\x1b[0m')
10+
11+
let multiConfigs = []
12+
demoDirectorys.forEach((entry) => {
13+
const _entry = path.resolve(__dirname, entry)
14+
multiConfigs.push({
15+
entry: `${_entry}/main.js`,
16+
output: {
17+
filename: 'build.js',
18+
path: path.resolve(__dirname, _entry)
19+
}
20+
})
21+
})
22+
23+
const isProduction = process.env.NODE_ENV === 'production'
24+
25+
module.exports = multiConfigs.map((config) => {
26+
return Object.assign(config, {
27+
stats: 'minimal',
28+
29+
mode: isProduction ? 'production' : 'development',
30+
31+
resolve: {
32+
alias: {
33+
'vue$': 'vue/dist/vue.js',
34+
'vue-virtual-scroll-list': path.resolve(__dirname, '../index.js')
35+
}
36+
},
37+
38+
plugins: [
39+
new VueLoaderPlugin()
40+
],
41+
42+
devtool: '#source-map',
43+
44+
module: {
45+
rules: [
46+
{
47+
test: /\.vue$/,
48+
loader: 'vue-loader'
49+
},
50+
{
51+
test: /.js$/,
52+
exclude: /node_modules/,
53+
use: {
54+
loader: 'babel-loader',
55+
options: {
56+
presets: ['env']
57+
}
58+
}
59+
},
60+
{
61+
test: /\.css$/,
62+
use: [
63+
{
64+
loader: 'vue-style-loader'
65+
},
66+
{
67+
loader: 'css-loader',
68+
options: {
69+
modules: true,
70+
localIdentName: '[local]_[hash:base64:8]'
71+
}
72+
}
73+
]
74+
}
75+
]
76+
}
77+
})
78+
})

0 commit comments

Comments
 (0)