Blame view

Yi.Vben5.Vue3/apps/web-antd/src/app.vue 911 Bytes
515fceeb   “wangming”   框架初始化
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
  <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 { antdLocale } from '#/locales';
  
  // import { useUploadTip } from './upload-tip';
  
  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,
    };
  });
  
  // useUploadTip();
  </script>
  
  <template>
    <ConfigProvider :locale="antdLocale" :theme="tokenTheme">
      <App>
        <RouterView />
      </App>
    </ConfigProvider>
  </template>