forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBehaviorMenu.vue
More file actions
66 lines (61 loc) · 1.27 KB
/
BehaviorMenu.vue
File metadata and controls
66 lines (61 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
<template>
<div class="q-pa-md">
<div class="q-gutter-md row">
<q-select
filled
v-model="model"
label="Simple select"
:options="stringOptions"
style="width: 250px"
behavior="menu"
/>
<q-select
filled
v-model="model"
use-input
input-debounce="0"
label="Simple filter"
:options="options"
@filter="filterFn"
style="width: 250px"
behavior="menu"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
No results
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</div>
</template>
<script>
const stringOptions = [
'Google', 'Facebook', 'Twitter', 'Apple', 'Oracle'
]
export default {
data () {
return {
model: null,
stringOptions,
options: stringOptions
}
},
methods: {
filterFn (val, update) {
if (val === '') {
update(() => {
this.options = stringOptions
})
return
}
update(() => {
const needle = val.toLowerCase()
this.options = stringOptions.filter(v => v.toLowerCase().indexOf(needle) > -1)
})
}
}
}
</script>