forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionLazyLoad.vue
More file actions
68 lines (60 loc) · 1.27 KB
/
OptionLazyLoad.vue
File metadata and controls
68 lines (60 loc) · 1.27 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
64
65
66
67
68
<template>
<div class="q-pa-md">
<div class="q-gutter-md row items-start">
<q-select
filled
v-model="model"
use-chips
label="Lazy load opts"
:options="options"
@filter="filterFn"
@filter-abort="abortFilterFn"
style="width: 250px"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
No results
</q-item-section>
</q-item>
</template>
</q-select>
<q-btn
v-if="options"
label="Reset"
color="primary"
@click="options = null"
/>
</div>
</div>
</template>
<script>
import { ref } from 'vue'
const stringOptions = [
'Google', 'Facebook', 'Twitter', 'Apple', 'Oracle'
]
export default {
setup () {
const options = ref(null)
return {
model: ref(null),
options,
filterFn (val, update, abort) {
if (options.value !== null) {
// already loaded
update()
return
}
setTimeout(() => {
update(() => {
options.value = stringOptions
})
}, 2000)
},
abortFilterFn () {
// console.log('delayed filter aborted')
}
}
}
}
</script>