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-07-28 09:01:19 +00:00
|
|
|
import { useDesignTokens } from '@vben/hooks';
|
2024-07-22 16:03:59 +00:00
|
|
|
import { preferences, usePreferences } from '@vben/preferences';
|
2024-06-01 15:15:29 +00:00
|
|
|
|
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-07-28 09:01:19 +00:00
|
|
|
const { antDesignTokens } = useDesignTokens();
|
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-07-29 14:11:22 +00:00
|
|
|
token: antDesignTokens,
|
2024-05-19 13:20:42 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-07-29 14:11:22 +00:00
|
|
|
<ConfigProvider :locale="antdLocale" :theme="tokenTheme">
|
|
|
|
<App>
|
|
|
|
<RouterView />
|
|
|
|
</App>
|
|
|
|
</ConfigProvider>
|
2024-05-19 13:20:42 +00:00
|
|
|
</template>
|