Skip to content

Commit 5acb448

Browse files
committed
Fixed mix compact infinite example.
1 parent 1ee9e63 commit 5acb448

File tree

2 files changed

+22
-31
lines changed

2 files changed

+22
-31
lines changed

examples/build/infinite.js

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

examples/infinite/infinite.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<VirtualList class="list"
99
:size="50"
1010
:remain="6"
11-
:totop="toTop"
1211
:tobottom="toBottom"
1312
>
1413
<Item v-for="(udf, index) of items" :index="index" :key="index"></Item>
@@ -26,7 +25,7 @@
2625
import Loading from './loading.vue'
2726
import VirtualList from 'virtual-list'
2827
29-
function getList (length) {
28+
const getList = (length) => {
3029
return new Array(length)
3130
}
3231
@@ -44,19 +43,16 @@
4443
},
4544
4645
methods: {
47-
toTop () {
48-
console.log('At top now.')
49-
},
50-
5146
toBottom () {
52-
this.loading = true
53-
console.log('At bottom now.')
54-
55-
setTimeout(() => {
56-
this.times++
57-
this.loading = false
58-
this.items = this.items.concat(getList(20))
59-
}, 2017)
47+
if (!this.loading) {
48+
this.loading = true
49+
// Mock for requesting delay.
50+
setTimeout(() => {
51+
this.times++
52+
this.loading = false
53+
this.items = this.items.concat(getList(20))
54+
}, 2017)
55+
}
6056
}
6157
}
6258
}

0 commit comments

Comments
 (0)