initial commit
This commit is contained in:
31
app/components/ui/LangSelect.vue
Normal file
31
app/components/ui/LangSelect.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
// This Component is Not used any more, as long as I use Buttons to switch between languages.
|
||||
const { locales, locale, setLocale } = useI18n()
|
||||
|
||||
// Langues disponibles sauf celle courante
|
||||
const otherLocales = computed(() =>
|
||||
locales.value.filter(l => l.code !== locale.value)
|
||||
)
|
||||
|
||||
// Changer la langue
|
||||
function changeLocale(locale: 'fr' | 'en') {
|
||||
setLocale(locale)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button class="panel-item" v-for="l in otherLocales" :key="l.code"
|
||||
@click="changeLocale(l.code)"
|
||||
>{{ l.name }}</button>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
|
||||
|
||||
/* Optional: transition hover pour le select */
|
||||
select:hover {
|
||||
border-color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user