mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-26 03:06:47 +03:00
cbd5867275
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
24 lines
571 B
Vue
24 lines
571 B
Vue
<script lang="ts" setup>
|
|
import type { ComputedRef } from 'vue'
|
|
import type { LocaleObject } from '#i18n'
|
|
|
|
const { locale, t, setLocale } = useI18n()
|
|
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
|
|
</script>
|
|
|
|
<template>
|
|
<CommonDropdown>
|
|
<slot />
|
|
|
|
<template #popper>
|
|
<CommonDropdownItem
|
|
v-for="item in locales"
|
|
:key="item.code"
|
|
:checked="item.code === locale"
|
|
@click="setLocale(item.code)"
|
|
>
|
|
{{ item.name }}
|
|
</CommonDropdownItem>
|
|
</template>
|
|
</CommonDropdown>
|
|
</template>
|