-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.vue
89 lines (78 loc) · 2.18 KB
/
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
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
78
79
80
81
82
83
84
85
86
87
88
89
<template>
<div>
<NuxtLayout :name="layout">
<NuxtErrorBoundary>
<template #error="{ error }">
<div class="text-center">
<p>Oh no, something broke!</p>
<code>{{ error }}</code>
<Button @click="resetError(error)">Reset</Button>
</div>
</template>
<template #default>
<!-- <Suspense> -->
<NuxtPage />
<!-- </Suspense> -->
</template>
</NuxtErrorBoundary>
</NuxtLayout>
<Toast />
</div>
</template>
<script setup lang="ts">
import './App.scss';
import { useAppStore } from "@/stores/app";
// import error from './plugins/error';
const route = useRoute();
const appState = useAppStore();
// You might choose this based on an API call or logged-in status
// const layout = ref<any>("default");
const layout = ref<any>("main");
// const layout = ref<any>(route.name != "report" ? "main" : false);
// function enableCustomLayout() {
// setPageLayout("custom");
// }
// definePageMeta({
// layout: layout.value,
// // pageTransition: false
// // layoutTransition: false
// pageTransition: {
// // name: 'rotate'
// // name: 'slide-in'
// name: "bounce",
// mode: "out-in", // default
// onBeforeEnter: (el) => {
// console.log("Before enter...");
// },
// onEnter: (el, done) => {},
// onAfterEnter: (el) => {},
// // middleware (to, from) {
// // to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right'
// // }
// },
// });
const resetError = async(error: { value: null; }) =>{
// await navigateTo("/");
// error.value = null;
throw createError({
// statusCode: 500,
fatal: true,
message: `FatalError: ${error}`
})
}
// Watch for changes to the route object
watch(
() => route,
(to, from) => {
console.log('Route changed from', from.fullPath, 'to', to.fullPath)
// Do something else, like update data based on the route change
// ...
}
)
watch(appState.app, () => {
// console.warn("===========================");
console.info({ ...appState.app });
// console.error("===========================");
});
</script>
<style lang="scss"></style>