forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.vue
More file actions
51 lines (48 loc) · 1.2 KB
/
Menu.vue
File metadata and controls
51 lines (48 loc) · 1.2 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
<template>
<div class="q-pa-md">
<q-btn label="Open Menu" color="primary">
<q-menu>
<q-list>
<q-item tag="label">
<q-item-section avatar>
<q-checkbox v-model="firstItemEnabled" />
</q-item-section>
<q-item-section>
<q-item-label>First Item Enabled</q-item-label>
</q-item-section>
</q-item>
<q-item
v-for="n in 5"
:key="n"
v-close-popup="n > 1 || firstItemEnabled"
:clickable="n > 1 || firstItemEnabled"
@click="onClick(n)"
>
<q-item-section>Menu Item {{n}}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
</template>
<script>
import { useQuasar } from 'quasar'
import { ref } from 'vue'
export default {
setup () {
const $q = useQuasar()
const firstItemEnabled = ref(false)
return {
firstItemEnabled,
onClick (index) {
if (index > 1 || firstItemEnabled.value) {
$q.notify({
message: `Clicked on menu item #${index} and closed QMenu`,
color: 'primary'
})
}
}
}
}
}
</script>