-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
35 lines (31 loc) · 823 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
<script lang="ts" setup>
const languages = usePreferredLanguages()
const { setLocale } = useI18n()
const locale = useCookie('i18n_redirected')
onMounted(() => {
if (locale.value) {
setLocale(locale.value)
} else {
setLocale(languages.value[0] || 'en-US')
}
})
window.addEventListener('resize', () => {
// First we get the viewport height and we multiple it by 1% to get a value for a vh unit
let vh = window.innerHeight * 0.01
// Then we set the value in the --vh custom property to the root of the document
document.documentElement.style.setProperty('--vh', `${vh}px`)
})
</script>
<template>
<div>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</template>
<style>
.vh {
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
}
</style>