刘光辉
11 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script lang="ts" setup>
import { computed } from 'vue';
 
import { useAntdDesignTokens } from '@vben/hooks';
import { preferences, usePreferences } from '@vben/preferences';
 
import { App, ConfigProvider, theme } from 'ant-design-vue';
 
import GlobalCustomViewModal from '#/components/GlobalCustomViewModal/index.vue';
import GlobalFormModal from '#/components/GlobalFormModal/index.vue';
import GlobalCustomPrintModal from '#/components/GlobalCustomPrintModal/index.vue';
import GlobalFlowDetailPopup from '#/components/GlobalFlowDetailPopup/index.vue';
import GlobalFlowListModal from '#/components/GlobalFlowListModal/index.vue';
import GlobalListModal from '#/components/GlobalListModal/index.vue';
import GlobalOfficeDocumentModal from '#/components/GlobalOfficeDocumentModal/index.vue';
import GlobalReportViewModal from '#/components/GlobalReportViewModal/index.vue';
import { antdLocale } from '#/locales';
 
defineOptions({ name: 'App' });
 
const { isDark } = usePreferences();
const { tokens } = useAntdDesignTokens();
 
const tokenTheme = computed(() => {
  const algorithm = isDark.value ? [theme.darkAlgorithm] : [theme.defaultAlgorithm];
 
  // antd 紧凑模式算法
  if (preferences.app.compact) {
    algorithm.push(theme.compactAlgorithm);
  }
 
  return {
    algorithm,
    token: {
      ...tokens,
      borderRadius: 4,
    },
  };
});
</script>
 
<template>
  <ConfigProvider :locale="antdLocale" :theme="tokenTheme">
    <App>
      <RouterView />
      <GlobalCustomViewModal />
      <GlobalFormModal />
      <GlobalCustomPrintModal />
      <GlobalFlowDetailPopup />
      <GlobalFlowListModal />
      <GlobalListModal />
      <GlobalOfficeDocumentModal />
      <GlobalReportViewModal />
    </App>
  </ConfigProvider>
</template>