2022-11-28 07:58:29 +01:00
|
|
|
<script lang="ts" setup>
|
2022-11-28 17:49:30 +01:00
|
|
|
import type { ComputedRef } from 'vue'
|
2022-11-29 07:29:09 +01:00
|
|
|
import type { LocaleObject } from '#i18n'
|
2022-11-28 07:58:29 +01:00
|
|
|
|
2022-11-29 07:29:09 +01:00
|
|
|
const { locale, t, setLocale } = useI18n()
|
|
|
|
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
|
2022-11-28 07:58:29 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-12-04 15:17:02 +01:00
|
|
|
<CommonDropdown>
|
|
|
|
<slot />
|
2022-11-28 07:58:29 +01:00
|
|
|
|
2022-12-04 15:17:02 +01:00
|
|
|
<template #popper>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-for="item in locales"
|
|
|
|
:key="item.code"
|
|
|
|
:checked="item.code === locale"
|
|
|
|
@click="setLocale(item.code)"
|
|
|
|
>
|
|
|
|
{{ item.name }}
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</template>
|
|
|
|
</CommonDropdown>
|
2022-11-28 07:58:29 +01:00
|
|
|
</template>
|