forked from KUN1007/kun-galgame-nuxt3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
77 lines (67 loc) · 1.44 KB
/
error.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<script setup lang="ts">
const error = useError()
const localePath = useLocalePath()
const handleError = async () => {
clearError({
redirect: localePath('/').toString()
})
await new Promise((resolve) => {
setTimeout(resolve, 1007)
})
location.reload()
}
</script>
<template>
<KunLayout>
<div class="root" v-if="error">
<div class="card" v-if="error.statusCode === 404">
<h1>404</h1>
<NuxtImg :src="useRandomSticker" />
<p>{{ $t('pageError.404') }}</p>
<KunButton type="danger" @click="handleError">
{{ $t('pageError.remake') }}
</KunButton>
</div>
<div class="card" v-else>
<h1>{{ error.message }}</h1>
<p>{{ $t('pageError.error') }}</p>
<KunButton type="danger" @click="handleError">
{{ $t('pageError.remake') }}
</KunButton>
</div>
</div>
</KunLayout>
</template>
<style lang="scss" scoped>
.root {
display: flex;
flex-direction: column;
height: 100%;
min-height: calc(100dvh - 75px);
max-width: 64rem;
margin: 0 auto;
}
.card {
margin: 0 auto;
padding: 17px;
@include kun-center;
flex-direction: column;
@include kun-blur;
h1 {
color: var(--kungalgame-red-5);
&::before {
content: '';
color: var(--kungalgame-blue-5);
margin-right: 0;
}
}
img {
margin: 10px 0;
}
p {
text-align: center;
font-weight: bold;
margin-bottom: 17px;
}
}
</style>