1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-09 18:39:58 +00:00
elk/components/nav/SelectLanguage.vue

29 lines
784 B
Vue
Raw Normal View History

<script lang="ts" setup>
2022-11-28 16:49:30 +00:00
import type { ComputedRef } from 'vue'
import type { LocaleObject } from '#i18n'
const { locale, t, setLocale } = useI18n()
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
</script>
<template>
2022-11-28 22:57:27 +00:00
<CommonTooltip :content="t('nav_footer.select_language')">
<CommonDropdown>
2022-11-29 21:24:26 +00:00
<button flex :aria-label="t('nav_footer.select_language')">
<div i-ri:earth-line text-lg />
</button>
<template #popper>
<CommonDropdownItem
2022-11-28 16:49:30 +00:00
v-for="item in locales"
:key="item.code"
:checked="item.code === locale"
2022-11-30 00:22:35 +00:00
@click="setLocale(item.code)"
>
2022-11-28 16:49:30 +00:00
{{ item.name }}
</CommonDropdownItem>
</template>
</CommonDropdown>
</CommonTooltip>
</template>