forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelected.vue
More file actions
46 lines (42 loc) · 1.07 KB
/
Selected.vue
File metadata and controls
46 lines (42 loc) · 1.07 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
<template>
<div class="q-pa-md">
<div class="q-gutter-xs">
<q-chip v-model:selected="desert.Icecream" color="primary" text-color="white" icon="cake">
Ice cream
</q-chip>
<q-chip v-model:selected="desert.Eclair" color="teal" text-color="white" icon="cake">
Eclair
</q-chip>
<q-chip v-model:selected="desert.Cupcake" color="orange" text-color="white" icon="cake">
Cupcake
</q-chip>
<q-chip v-model:selected="desert.Gingerbread" color="red" text-color="white" icon="cake">
Gingerbread
</q-chip>
</div>
<div class="q-mt-sm">
Your pick: {{ selection }}
</div>
</div>
</template>
<script>
import { reactive, computed } from 'vue'
export default {
setup () {
const desert = reactive({
Icecream: false,
Eclair: true,
Cupcake: false,
Gingerbread: false
})
return {
desert,
selection: computed(() => {
return Object.keys(desert)
.filter(type => desert[ type ] === true)
.join(', ')
})
}
}
}
</script>