2022-12-27 23:03:50 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import type { ComputedRef } from 'vue'
|
|
|
|
import type { LocaleObject } from '#i18n'
|
|
|
|
|
|
|
|
const { locale, setLocale } = useI18n()
|
|
|
|
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<select :value="locale" @input="e => setLocale((e.target as any).value)">
|
2022-12-28 03:50:29 +00:00
|
|
|
<option v-for="item in locales" :key="item.code" :value="item.code" :selected="locale === item.code">
|
2022-12-27 23:03:50 +00:00
|
|
|
{{ item.name }}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</template>
|