forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainer.vue
More file actions
63 lines (56 loc) · 2.12 KB
/
Container.vue
File metadata and controls
63 lines (56 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
<div>
<div ref="scrollTargetRef" class="q-pa-md" style="max-height: 250px; overflow: auto;">
<q-infinite-scroll @load="onLoadRef" :offset="250" :scroll-target="scrollTargetRef">
<div v-for="(item, index) in itemsRef" :key="index" class="caption">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum repellendus sit voluptate voluptas eveniet porro. Rerum blanditiis perferendis totam, ea at omnis vel numquam exercitationem aut, natus minima, porro labore.</p>
</div>
<template v-slot:loading>
<div class="row justify-center q-my-md">
<q-spinner-dots color="primary" size="40px" />
</div>
</template>
</q-infinite-scroll>
</div>
<q-separator style="height: 2px" />
<div id="scroll-target-id" class="q-pa-md" style="max-height: 248px; overflow: auto;">
<q-infinite-scroll @load="onLoadId" :offset="250" scroll-target="#scroll-target-id">
<div v-for="(item, index) in itemsId" :key="index" class="caption">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum repellendus sit voluptate voluptas eveniet porro. Rerum blanditiis perferendis totam, ea at omnis vel numquam exercitationem aut, natus minima, porro labore.</p>
</div>
<template v-slot:loading>
<div class="row justify-center q-my-md">
<q-spinner-dots color="primary" size="40px" />
</div>
</template>
</q-infinite-scroll>
</div>
</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup () {
const itemsRef = ref([ {}, {}, {}, {}, {}, {}, {} ])
const itemsId = ref([ {}, {}, {}, {}, {}, {}, {} ])
const scrollTargetRef = ref(null)
return {
itemsRef,
itemsId,
scrollTargetRef,
onLoadRef (index, done) {
setTimeout(() => {
itemsRef.value.push({}, {}, {}, {}, {}, {}, {})
done()
}, 2000)
},
onLoadId (index, done) {
setTimeout(() => {
itemsId.value.push({}, {}, {}, {}, {}, {}, {})
done()
}, 2000)
}
}
}
}
</script>