App.vue 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <script lang="ts" setup>
  2. import { computed } from 'vue';
  3. import { useAntdDesignTokens } from '@vben/hooks';
  4. import { preferences, usePreferences } from '@vben/preferences';
  5. import { App, ConfigProvider, theme } from 'ant-design-vue';
  6. import { useAntdLocale } from '#/locales/antd.locale';
  7. defineOptions({ name: 'App' });
  8. const { isDark } = usePreferences();
  9. const { tokens } = useAntdDesignTokens();
  10. const antdLocale = useAntdLocale();
  11. const tokenTheme = computed(() => {
  12. const algorithm = isDark.value
  13. ? [theme.darkAlgorithm]
  14. : [theme.defaultAlgorithm];
  15. // antd 紧凑模式算法
  16. if (preferences.app.compact) {
  17. algorithm.push(theme.compactAlgorithm);
  18. }
  19. return {
  20. algorithm,
  21. token: tokens,
  22. };
  23. });
  24. </script>
  25. <template>
  26. <ConfigProvider :locale="antdLocale" :theme="tokenTheme">
  27. <App>
  28. <RouterView />
  29. </App>
  30. </ConfigProvider>
  31. </template>
  32. <style>
  33. .ant-select-tree-node-w-full {
  34. .ant-select-tree-treenode {
  35. width: 100%;
  36. }
  37. }
  38. </style>