mirror of
https://github.com/KwiTsukasa/kt-template-admin.git
synced 2026-05-27 16:35:47 +08:00
41 lines
976 B
TypeScript
41 lines
976 B
TypeScript
import { computed, defineComponent } from 'vue';
|
|
import { RouterView } from 'vue-router';
|
|
|
|
import { useAntdDesignTokens } from '@vben/hooks';
|
|
import { preferences, usePreferences } from '@vben/preferences';
|
|
|
|
import { App as AntdApp, ConfigProvider, theme } from 'antdv-next';
|
|
|
|
import { antdLocale } from '#/locales';
|
|
|
|
export default defineComponent({
|
|
name: 'App',
|
|
setup() {
|
|
const { isDark } = usePreferences();
|
|
const { tokens } = useAntdDesignTokens();
|
|
|
|
const tokenTheme = computed(() => {
|
|
const algorithm = isDark.value
|
|
? [theme.darkAlgorithm]
|
|
: [theme.defaultAlgorithm];
|
|
|
|
if (preferences.app.compact) {
|
|
algorithm.push(theme.compactAlgorithm);
|
|
}
|
|
|
|
return {
|
|
algorithm,
|
|
token: tokens,
|
|
};
|
|
});
|
|
|
|
return () => (
|
|
<ConfigProvider locale={antdLocale.value} theme={tokenTheme.value}>
|
|
<AntdApp>
|
|
<RouterView />
|
|
</AntdApp>
|
|
</ConfigProvider>
|
|
);
|
|
},
|
|
});
|