Blame view

src/layouts/default/content/index.tsx 1.09 KB
vben authored
1
2
import './index.less';
vben authored
3
import { defineComponent, unref, computed } from 'vue';
vben authored
4
5
6
7
8
import { FullLoading } from '/@/components/Loading/index';

import { RouterView } from 'vue-router';

import { useRootSetting } from '/@/hooks/setting/useRootSetting';
vben authored
9
10
import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting';
vben authored
11
12
13
14

export default defineComponent({
  name: 'LayoutContent',
  setup() {
vben authored
15
16
17
    const { getOpenPageLoading } = useTransitionSetting();
    const { getShowMultipleTab } = useMultipleTabSetting();
    const { getLayoutContentMode, getPageLoading } = useRootSetting();
vben authored
18
vben authored
19
20
21
22
23
24
    const getLoadingClass = computed(() => {
      return [
        `layout-content__loading`,
        { fill: unref(getShowMultipleTab), hidden: !unref(getPageLoading) },
      ];
    });
vben authored
25
26
27
    return () => {
      return (
        <div class={['layout-content', unref(getLayoutContentMode)]}>
vben authored
28
          {unref(getOpenPageLoading) && <FullLoading class={unref(getLoadingClass)} />}
vben authored
29
30
31
32
33
34
          <RouterView />
        </div>
      );
    };
  },
});