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-23 12:03:41 +00:00
|
|
|
import { GlobalProvider } from '@vben/widgets';
|
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-06-08 11:49:06 +00:00
|
|
|
|
2024-07-06 16:17:44 +00:00
|
|
|
import { antdLocale } from '#/locales';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
|
|
|
defineOptions({ name: 'App' });
|
|
|
|
|
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>
|
2024-07-07 14:14:40 +00:00
|
|
|
<GlobalProvider
|
|
|
|
:enable-ai-assistant="preferences.app.aiAssistant"
|
|
|
|
:is-mobile="preferences.app.isMobile"
|
|
|
|
>
|
2024-06-30 07:42:30 +00:00
|
|
|
<ConfigProvider :locale="antdLocale" :theme="tokenTheme">
|
2024-06-21 16:25:13 +00:00
|
|
|
<App>
|
|
|
|
<RouterView />
|
|
|
|
</App>
|
2024-05-19 13:20:42 +00:00
|
|
|
</ConfigProvider>
|
|
|
|
</GlobalProvider>
|
|
|
|
</template>
|