2024-05-19 13:20:42 +00:00
|
|
|
<script lang="ts" setup>
|
2024-06-08 11:49:06 +00:00
|
|
|
import { computed } from 'vue';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
2024-06-16 15:20:09 +00:00
|
|
|
import { GlobalProvider } from '@vben/universal-ui';
|
2024-06-01 15:15:29 +00:00
|
|
|
import { preferences, usePreferences } from '@vben-core/preferences';
|
|
|
|
|
2024-06-21 16:25:13 +00:00
|
|
|
import { App, ConfigProvider, theme } from 'ant-design-vue';
|
2024-05-19 13:20:42 +00:00
|
|
|
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
|
|
|
import dayjs from 'dayjs';
|
2024-06-08 11:49:06 +00:00
|
|
|
|
|
|
|
import 'dayjs/locale/zh-cn';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
|
|
|
defineOptions({ name: 'App' });
|
|
|
|
|
|
|
|
dayjs.locale(zhCN.locale);
|
|
|
|
|
2024-06-01 15:15:29 +00:00
|
|
|
const { isDark } = usePreferences();
|
2024-05-19 13:20:42 +00:00
|
|
|
|
|
|
|
const tokenTheme = computed(() => {
|
2024-06-21 16:25:13 +00:00
|
|
|
const algorithm = isDark.value
|
2024-05-19 13:20:42 +00:00
|
|
|
? [theme.darkAlgorithm]
|
|
|
|
: [theme.defaultAlgorithm];
|
|
|
|
|
|
|
|
// antd 紧凑模式算法
|
2024-06-01 15:15:29 +00:00
|
|
|
if (preferences.app.compact) {
|
2024-06-21 16:25:13 +00:00
|
|
|
algorithm.push(theme.compactAlgorithm);
|
2024-05-19 13:20:42 +00:00
|
|
|
}
|
2024-06-21 16:25:13 +00:00
|
|
|
|
2024-05-19 13:20:42 +00:00
|
|
|
return {
|
2024-06-21 16:25:13 +00:00
|
|
|
algorithm,
|
2024-06-01 15:15:29 +00:00
|
|
|
token: { colorPrimary: preferences.theme.colorPrimary },
|
2024-05-19 13:20:42 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<GlobalProvider>
|
|
|
|
<ConfigProvider :locale="zhCN" :theme="tokenTheme">
|
2024-06-21 16:25:13 +00:00
|
|
|
<App>
|
|
|
|
<RouterView />
|
|
|
|
</App>
|
2024-05-19 13:20:42 +00:00
|
|
|
</ConfigProvider>
|
|
|
|
</GlobalProvider>
|
|
|
|
</template>
|