2023-01-29 15:26:45 +08:00
|
|
|
<template>
|
2025-06-28 23:57:01 +08:00
|
|
|
<AConfigProvider :locale="antdvLocale" :theme="tokenTheme">
|
2025-04-07 23:52:21 +08:00
|
|
|
<FsFormProvider>
|
2025-03-21 23:11:58 +08:00
|
|
|
<contextHolder />
|
2025-03-06 21:11:07 +08:00
|
|
|
<router-view />
|
2025-04-07 23:52:21 +08:00
|
|
|
</FsFormProvider>
|
2025-03-04 19:24:24 +00:00
|
|
|
</AConfigProvider>
|
2023-01-29 15:26:45 +08:00
|
|
|
</template>
|
|
|
|
|
|
2024-10-15 17:12:42 +08:00
|
|
|
<script lang="ts" setup>
|
2025-06-28 23:57:01 +08:00
|
|
|
import { computed, provide, ref } from "vue";
|
|
|
|
|
import { preferences, usePreferences } from "/@/vben/preferences";
|
2025-03-03 19:24:51 +00:00
|
|
|
import { useAntdDesignTokens } from "/@/vben/hooks";
|
2025-06-28 23:57:01 +08:00
|
|
|
import { Modal, theme } from "ant-design-vue";
|
2025-03-04 19:24:24 +00:00
|
|
|
import AConfigProvider from "ant-design-vue/es/config-provider";
|
2025-06-28 23:57:01 +08:00
|
|
|
import { antdvLocale } from "./locales/antdv";
|
|
|
|
|
import { setI18nLanguage } from "/@/locales";
|
2024-10-15 17:12:42 +08:00
|
|
|
defineOptions({
|
2025-03-21 23:11:58 +08:00
|
|
|
name: "App",
|
2024-10-15 17:12:42 +08:00
|
|
|
});
|
2025-06-28 23:57:01 +08:00
|
|
|
|
2024-10-15 17:12:42 +08:00
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
provide("modal", modal);
|
|
|
|
|
|
2025-06-28 23:57:01 +08:00
|
|
|
const locale = preferences.app.locale;
|
|
|
|
|
setI18nLanguage(locale);
|
2025-05-16 23:14:43 +08:00
|
|
|
|
2025-03-03 19:24:51 +00:00
|
|
|
const { isDark } = usePreferences();
|
|
|
|
|
const { tokens } = useAntdDesignTokens();
|
2023-01-29 15:26:45 +08:00
|
|
|
|
2025-03-03 19:24:51 +00:00
|
|
|
const tokenTheme = computed(() => {
|
|
|
|
|
const algorithm = isDark.value ? [theme.darkAlgorithm] : [theme.defaultAlgorithm];
|
|
|
|
|
|
|
|
|
|
// antd 紧凑模式算法
|
|
|
|
|
if (preferences.app.compact) {
|
|
|
|
|
algorithm.push(theme.compactAlgorithm);
|
2023-01-29 15:26:45 +08:00
|
|
|
}
|
2025-03-03 19:24:51 +00:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
algorithm,
|
2025-03-21 23:11:58 +08:00
|
|
|
token: tokens,
|
2025-03-03 19:24:51 +00:00
|
|
|
};
|
|
|
|
|
});
|
2023-01-29 15:26:45 +08:00
|
|
|
</script>
|