-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathapp.vue
45 lines (41 loc) · 981 Bytes
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script setup lang="ts">
const { locale, t } = useI18n();
const isLoading = ref(true);
if (import.meta.client) {
const storedLanguage = localStorage.getItem("nuxt-lang");
if (storedLanguage && storedLanguage !== "en-US") {
locale.value = storedLanguage;
}
}
onMounted(() => {
// Remove loading state after initial render
nextTick(() => {
isLoading.value = false;
});
});
useHead({
htmlAttrs: {
lang: locale,
dir: computed(() => {
return t("locale.dir") as "ltr" | "rtl" | "auto";
}),
},
titleTemplate(title) {
return title ? `${title} - ${t("site.name")}` : `${t("site.name")}`;
},
});
</script>
<template>
<div class="relative">
<div
v-if="isLoading"
class="fixed inset-0 z-50 flex items-center justify-center bg-white transition-opacity duration-300 dark:bg-gray-900"
></div>
<NuxtLayout>
<div>
<CookieBanner />
<NuxtPage />
</div>
</NuxtLayout>
</div>
</template>