From 3f78b5aa0cd3e7a6f17d58512ca93ee2905d5e2f Mon Sep 17 00:00:00 2001 From: vben <anncwb@126.com> Date: 星期四, 12 十一月 2020 23:58:44 +0800 Subject: [PATCH] fix: pageLoading not working --- src/layouts/default/LayoutContent.tsx | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/layouts/default/LayoutContent.tsx b/src/layouts/default/LayoutContent.tsx index 464fb39..2944439 100644 --- a/src/layouts/default/LayoutContent.tsx +++ b/src/layouts/default/LayoutContent.tsx @@ -1,24 +1,31 @@ -import { defineComponent } from 'vue'; +import { computed, defineComponent, unref } from 'vue'; import { Layout } from 'ant-design-vue'; -import { RouterView } from 'vue-router'; +import { FullLoading } from '/@/components/Loading/index'; -// hooks +import { RouterView } from 'vue-router'; import { ContentEnum } from '/@/enums/appEnum'; import { appStore } from '/@/store/modules/app'; -// import PageLayout from '/@/layouts/page/index'; export default defineComponent({ name: 'DefaultLayoutContent', setup() { + const getProjectConfigRef = computed(() => { + return appStore.getProjectConfig; + }); + return () => { - const { getProjectConfig } = appStore; - const { contentMode } = getProjectConfig; + const { contentMode, openPageLoading } = unref(getProjectConfigRef); + const { getPageLoading } = appStore; const wrapClass = contentMode === ContentEnum.FULL ? 'full' : 'fixed'; return ( - <Layout.Content class={`layout-content ${wrapClass} `}> - {() => <RouterView />} - {/* <PageLayout class={`layout-content ${wrapClass} `} /> */} - </Layout.Content> + <div class={[`default-layout__main`]}> + {openPageLoading && ( + <FullLoading class={[`default-layout__loading`, !getPageLoading && 'hidden']} /> + )} + <Layout.Content class={`layout-content ${wrapClass} `}> + {() => <RouterView />} + </Layout.Content> + </div> ); }; }, -- Gitblit v1.8.0