Skip to content

Commit 66abc4a

Browse files
committed
feat(frontend): add loading indicator
1 parent 1e1d2a7 commit 66abc4a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

frontend/src/App.vue

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script setup lang="ts">
22
import { useHead, useSeoMeta } from '@unhead/vue'
3+
import { ref } from 'vue'
4+
import { useRouter } from 'vue-router'
5+
6+
import Valory from '@/components/icons/Valory.vue'
37
48
const titleMain = 'VALORY'
59
const metaImg = 'meta.webp'
@@ -35,8 +39,29 @@ useSeoMeta({
3539
author: 'MAGICX, [email protected]',
3640
keywords: metaKeywords,
3741
})
42+
43+
const isRouterReady = ref(false)
44+
const router = useRouter()
45+
router.isReady().finally(() => (isRouterReady.value = true))
3846
</script>
3947

4048
<template>
41-
<RouterView />
49+
<Transition>
50+
<div v-if="!isRouterReady" class="z-9999 flex h-[100dvh] items-center justify-center">
51+
<Valory :size="32" />
52+
</div>
53+
<RouterView v-else />
54+
</Transition>
4255
</template>
56+
57+
<style scoped>
58+
.v-enter-active,
59+
.v-leave-active {
60+
transition: opacity 0.5s ease;
61+
}
62+
63+
.v-enter-from,
64+
.v-leave-to {
65+
opacity: 0;
66+
}
67+
</style>

0 commit comments

Comments
 (0)