2022-01-04 02:20:32 +08:00
|
|
|
<script setup lang="ts">
|
2023-11-17 08:45:00 +08:00
|
|
|
import { computed } from 'vue';
|
|
|
|
import { NConfigProvider, darkTheme } from 'naive-ui';
|
|
|
|
import { useAppStore } from './store/modules/app';
|
|
|
|
import { useThemeStore } from './store/modules/theme';
|
2023-12-14 21:45:29 +08:00
|
|
|
import { naiveDateLocales, naiveLocales } from './locales/naive';
|
2023-11-17 08:45:00 +08:00
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
name: 'App'
|
|
|
|
});
|
|
|
|
|
|
|
|
const appStore = useAppStore();
|
|
|
|
const themeStore = useThemeStore();
|
2022-01-16 20:13:11 +08:00
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
const naiveDarkTheme = computed(() => (themeStore.darkMode ? darkTheme : undefined));
|
2022-01-16 20:13:11 +08:00
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
const naiveLocale = computed(() => {
|
|
|
|
return naiveLocales[appStore.locale];
|
|
|
|
});
|
|
|
|
|
|
|
|
const naiveDateLocale = computed(() => {
|
|
|
|
return naiveDateLocales[appStore.locale];
|
|
|
|
});
|
2024-07-29 23:04:26 +08:00
|
|
|
|
|
|
|
const watermarkProps = computed(() => {
|
|
|
|
return {
|
|
|
|
content: themeStore.watermark.text,
|
|
|
|
cross: true,
|
|
|
|
fullscreen: true,
|
|
|
|
fontSize: 16,
|
|
|
|
lineHeight: 16,
|
|
|
|
width: 384,
|
|
|
|
height: 384,
|
|
|
|
xOffset: 12,
|
|
|
|
yOffset: 60,
|
|
|
|
rotate: -15,
|
|
|
|
zIndex: 9999
|
|
|
|
};
|
|
|
|
});
|
2022-01-04 02:20:32 +08:00
|
|
|
</script>
|
2022-05-28 12:30:17 +08:00
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
<template>
|
2024-01-20 19:13:31 +08:00
|
|
|
<NConfigProvider
|
|
|
|
:theme="naiveDarkTheme"
|
|
|
|
:theme-overrides="themeStore.naiveTheme"
|
|
|
|
:locale="naiveLocale"
|
|
|
|
:date-locale="naiveDateLocale"
|
|
|
|
class="h-full"
|
|
|
|
>
|
|
|
|
<AppProvider>
|
|
|
|
<RouterView class="bg-layout" />
|
2024-07-29 23:04:26 +08:00
|
|
|
<NWatermark v-if="themeStore.watermark.visible" v-bind="watermarkProps" />
|
2024-01-20 19:13:31 +08:00
|
|
|
</AppProvider>
|
|
|
|
</NConfigProvider>
|
2023-11-17 08:45:00 +08:00
|
|
|
</template>
|
|
|
|
|
2022-01-03 22:20:10 +08:00
|
|
|
<style scoped></style>
|