Capital/components/LocaleSelect.vue

30 lines
709 B
Vue
Raw Permalink Normal View History

<template>
<v-menu>
<template v-slot:activator="{ props }">
<v-btn
size="small"
icon="mdi-translate"
v-bind="props"
/>
</template>
<v-list>
<v-list-item
class="w-48"
density="compact"
v-for="item in locales"
:key="item.code"
:value="item.code"
:active="locale == item.code"
2024-10-03 18:35:02 +00:00
@click.prevent.stop="() => { setLocale(item.code); emits('update') }"
>
<v-list-item-title>{{ item.name }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
<script lang="ts" setup>
2024-10-03 18:35:02 +00:00
const emits = defineEmits(['update'])
const { locale, locales, setLocale } = useI18n()
</script>