elk/components/settings/SettingsLanguage.vue

20 lines
501 B
Vue
Raw Normal View History

<script lang="ts" setup>
import type { ComputedRef } from 'vue'
import type { LocaleObject } from '#i18n'
2023-01-15 23:14:55 +00:00
const props = defineProps<{
language?: string
}>()
const model = useVModel(props, 'language')
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
</script>
<template>
2023-01-15 23:14:55 +00:00
<select v-model="model">
<option v-for="item in locales" :key="item.code" :value="item.code" :selected="props.language === item.code">
{{ item.name }}
</option>
</select>
</template>