App.vue 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <script setup lang="ts">
  2. import { computed } from 'vue'
  3. import { useAppStore } from '@/store/modules/app'
  4. import { useLocaleStore } from '@/store/modules/locale'
  5. import { ElConfigProvider } from 'element-plus'
  6. import { ConfigGlobal } from '@/components/ConfigGlobal'
  7. import { isDark } from '@/utils/is'
  8. const appStore = useAppStore()
  9. const localeStore = useLocaleStore()
  10. const locale = computed(() => localeStore.locale)
  11. const size = computed(() => appStore.size)
  12. function initDark() {
  13. const isDarkTheme = isDark()
  14. appStore.setIsDark(isDarkTheme)
  15. }
  16. initDark()
  17. </script>
  18. <template>
  19. <ConfigGlobal :size="size">
  20. <ElConfigProvider :locale="locale.elLocale" :size="size">
  21. <RouterView />
  22. </ElConfigProvider>
  23. </ConfigGlobal>
  24. </template>
  25. <style lang="less">
  26. .size {
  27. width: 100%;
  28. height: 100%;
  29. }
  30. html,
  31. body {
  32. padding: 0;
  33. margin: 0;
  34. .size;
  35. #app {
  36. .size;
  37. }
  38. }
  39. </style>