App.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!--
  2. * 主应用页面
  3. *
  4. * @Author: DCCloud
  5. * @Date: 2022-09-12 23:46:47
  6. -->
  7. <template>
  8. <a-config-provider :locale="antdLocale" :theme="{
  9. algorithm: compactFlag ? theme.compactAlgorithm : theme.defaultAlgorithm,
  10. token: {
  11. colorPrimary: themeColors[colorIndex].primaryColor,
  12. colorLink: themeColors[colorIndex].primaryColor,
  13. colorLinkActive: themeColors[colorIndex].activeColor,
  14. colorLinkHover: themeColors[colorIndex].hoverColor,
  15. colorIcon: themeColors[colorIndex].primaryColor,
  16. borderRadius: borderRadius,
  17. },
  18. components: {
  19. Button: {
  20. colorLink: themeColors[colorIndex].primaryColor,
  21. colorLinkActive: themeColors[colorIndex].activeColor,
  22. colorLinkHover: themeColors[colorIndex].hoverColor,
  23. },
  24. Icon: {
  25. colorIcon: themeColors[colorIndex].primaryColor,
  26. },
  27. },
  28. }">
  29. <!---全局loading--->
  30. <a-spin :spinning="spinning" tip="稍等片刻,我在拼命加载中..." size="large">
  31. <!--- 路由 -->
  32. <RouterView />
  33. </a-spin>
  34. </a-config-provider>
  35. </template>
  36. <script setup>
  37. import dayjs from 'dayjs';
  38. import { computed } from 'vue';
  39. import { messages } from '/@/i18n';
  40. import { useAppConfigStore } from '/@/store/modules/system/app-config';
  41. import { useSpinStore } from '/@/store/modules/system/spin';
  42. import { theme } from 'ant-design-vue';
  43. import { themeColors } from '/@/theme/color.js';
  44. const antdLocale = computed(() => messages[useAppConfigStore().language].antdLocale);
  45. const dayjsLocale = computed(() => messages[useAppConfigStore().language].dayjsLocale);
  46. dayjs.locale(dayjsLocale);
  47. // 全局loading
  48. let spinStore = useSpinStore();
  49. const spinning = computed(() => spinStore.loading);
  50. // 是否紧凑
  51. const compactFlag = computed(() => useAppConfigStore().compactFlag);
  52. // 主题颜色
  53. const colorIndex = computed(() => {
  54. return useAppConfigStore().colorIndex;
  55. });
  56. // 圆角
  57. const borderRadius = computed(() => {
  58. return useAppConfigStore().borderRadius;
  59. });
  60. </script>