forked from primefaces/primevue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
74 lines (68 loc) · 2.63 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
<template>
<div>
<NuxtLayout name="default">
<div class="flex card flex-column align-items-center gap-5 sm:p-8">
<div class="flex flex-column sm:flex-row align-items-center justify-content-center gap-3 text-primary">
<span class="font-bold" :style="{ fontSize: '144px' }"> 4 </span>
<div class="flex align-items-center justify-content-center bg-primary border-circle w-8rem h-8rem">
<i class="pi pi-prime text-7xl"></i>
</div>
<span class="font-bold" :style="{ fontSize: '144px' }"> 4 </span>
</div>
<div class="font-bold text-900 text-center text-6xl border-top-1 surface-border pt-5">PAGE NOT FOUND</div>
</div>
</NuxtLayout>
</div>
</template>
<script>
import EventBus from '@/layouts/AppEventBus';
export default {
watch: {
$route: {
handler(to) {
if (to.name === 'index') {
this.themeChangeListener({ theme: this.$appState.darkTheme ? 'aura-dark-green' : 'aura-light-green', dark: this.$appState.darkTheme });
}
}
}
},
created() {
useServerHead({
link: [
{
id: 'theme-link',
rel: 'stylesheet',
href: '/themes/aura-light-green/theme.css'
}
]
});
},
mounted() {
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.applyTheme({ theme: 'aura-dark-green', dark: true });
}
EventBus.on('theme-change', this.themeChangeListener);
},
beforeUnmount() {
EventBus.off('theme-change', this.themeChangeListener);
},
methods: {
themeChangeListener(event) {
if (!document.startViewTransition) {
this.applyTheme(event);
return;
}
document.startViewTransition(() => this.applyTheme(event));
},
applyTheme(event) {
this.$primevue.changeTheme(this.$appState.theme, event.theme, 'theme-link', () => {
this.$appState.theme = event.theme;
this.$appState.darkTheme = event.dark;
EventBus.emit('theme-change-complete', { theme: event.theme, dark: event.dark });
});
}
}
};
</script>