-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
41 lines (35 loc) · 1.02 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
<template>
<VApp>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<ClientOnly>
<VSnackbar
v-bind="snackbar.state.value.current"
v-model="snackbar.state.value.isActive"
@after-leave="snackbar.onAfterLeave"
>
<template #text>
<div class="d-flex align-center ga-2 pa-1">
<VIcon
v-if="snackbar.state.value.current?.icon"
:icon="snackbar.state.value.current.icon"
:color="snackbar.state.value.current.iconColor"
/>
<span class="w-100 text-caption">{{ snackbarText }}</span>
</div>
</template>
</VSnackbar>
</ClientOnly>
</VApp>
</template>
<script setup lang="ts">
import { truncate } from 'lodash-es';
const MAX_SNACKBAR_TEXT_LENGTH = 120;
const { snackbar } = useSnackbar();
const { initTheme } = useColorTheme();
const snackbarText = computed<string>(() =>
truncate(snackbar.state.value.current?.text, { length: MAX_SNACKBAR_TEXT_LENGTH }),
);
initTheme();
</script>