-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUserSettingsMenu.vue
73 lines (68 loc) · 2.05 KB
/
UserSettingsMenu.vue
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
69
70
71
72
73
<template>
<v-menu left bottom :close-on-content-click="false" class="menu">
<template v-slot:activator="{ props }">
<v-btn icon v-bind="props">
<v-icon>mdi-cog</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item
v-for="(setting, index) in store.listFavorite"
:key="index"
:disabled="setting?.disabled"
>
<v-list-item-subtitle>{{ setting.label }} </v-list-item-subtitle>
<v-list-item-action v-if="setting.type === 'oneOfMultiple'">
<v-btn-toggle
density="compact"
v-model="setting.value"
@update:model-value="onValueChange(setting)"
>
<v-btn
v-for="item of setting.items"
:key="item.value"
:value="item.value"
:disabled="item.disabled"
class="text-none"
>
<v-icon v-if="item.icon">{{ item.icon }}</v-icon>
<span v-else>{{ item.value }}</span>
<v-tooltip activator="parent" location="top">{{
item.value
}}</v-tooltip>
</v-btn>
</v-btn-toggle>
</v-list-item-action>
<v-list-item-action v-else-if="setting.type === 'boolean'">
<v-switch
density="compact"
v-model="setting.value"
color="primary"
:disabled="setting.disabled"
@update:modelValue="onValueChange(setting)"
hide-details
>
</v-switch>
</v-list-item-action>
</v-list-item>
<v-divider />
<v-list-item :to="{ name: 'UserSettingsView' }"
>All Settings ...</v-list-item
>
</v-list>
</v-menu>
</template>
<script setup lang="ts">
import type { UserSettingsItem } from '../../stores/userSettings'
import { useUserSettingsStore } from '../../stores/userSettings'
const store = useUserSettingsStore()
function onValueChange(item: UserSettingsItem) {
store.add(item)
}
</script>
<style scoped>
.menu {
position: relative;
z-index: 10000;
}
</style>