| | |
| | | import { defineComponent, unref, onMounted, computed } from 'vue'; |
| | | import { defineComponent, unref, computed } from 'vue'; |
| | | import { Layout, BackTop } from 'ant-design-vue'; |
| | | import LayoutHeader from './LayoutHeader'; |
| | | |
| | |
| | | import { useFullContent } from '/@/hooks/web/useFullContent'; |
| | | |
| | | import LockPage from '/@/views/sys/lock/index.vue'; |
| | | import { registerGlobComp } from '/@/components/registerGlobComp'; |
| | | |
| | | import './index.less'; |
| | | // import { userStore } from '/@/store/modules/user'; |
| | | export default defineComponent({ |
| | | name: 'DefaultLayout', |
| | | setup() { |
| | | // ! 在这里才注册全局组件 |
| | | // ! 可以减少首屏代码体积 |
| | | // default layout是在登录后才加载的。所以不会打包到首屏去 |
| | | registerGlobComp(); |
| | | |
| | | // 获取项目配置 |
| | | const { getFullContent } = useFullContent(); |
| | | |
| | | const getProjectConfigRef = computed(() => { |
| | | return appStore.getProjectConfig; |
| | | }); |
| | | |
| | | const getLockMainScrollStateRef = computed(() => { |
| | | return appStore.getLockMainScrollState; |
| | | }); |
| | |
| | | } = unref(getProjectConfigRef); |
| | | return show; |
| | | }); |
| | | |
| | | const isShowMixHeaderRef = computed(() => { |
| | | const { |
| | | menuSetting: { type }, |
| | |
| | | return show && mode !== MenuModeEnum.HORIZONTAL && !unref(getFullContent); |
| | | }); |
| | | |
| | | // const { currentRoute } = useRouter(); |
| | | onMounted(() => { |
| | | // Each refresh will request the latest user information, if you don’t need it, you can delete it |
| | | // userStore.getUserInfoAction({ userId: userStore.getUserInfoState.userId }); |
| | | }); |
| | | |
| | | // Get project configuration |
| | | // const { getFullContent } = useFullContent(currentRoute); |
| | | function getTarget(): any { |
| | |
| | | } = unref(getProjectConfigRef); |
| | | return document.querySelector(`.default-layout__${fixed ? 'main' : 'content'}`); |
| | | } |
| | | |
| | | return () => { |
| | | const { getPageLoading, getLockInfo } = appStore; |
| | | const { |
| | |
| | | multiTabsSetting: { show: showTabs }, |
| | | headerSetting: { fixed }, |
| | | } = unref(getProjectConfigRef); |
| | | // const fixedHeaderCls = fixed ? ('fixed' + getLockMainScrollState ? ' lock' : '') : ''; |
| | | |
| | | const fixedHeaderCls = fixed |
| | | ? 'fixed' + (unref(getLockMainScrollStateRef) ? ' lock' : '') |
| | | : ''; |
| | | |
| | | const { isLock } = getLockInfo; |
| | | return ( |
| | | <Layout class="default-layout relative"> |
| | | {() => ( |
| | | <> |
| | | {isLock && <LockPage />} |
| | | |
| | | {!unref(getFullContent) && unref(isShowMixHeaderRef) && unref(showHeaderRef) && ( |
| | | <LayoutHeader /> |
| | | )} |
| | | |
| | | {showSettingButton && <SettingBtn />} |
| | | |
| | | <Layout> |
| | | {() => ( |
| | | <> |
| | |
| | | {() => <MultipleTabs />} |
| | | </Layout.Header> |
| | | )} |
| | | |
| | | {useOpenBackTop && <BackTop target={getTarget} />} |
| | | |
| | | <div class={[`default-layout__main`, fixedHeaderCls]}> |
| | | {openPageLoading && ( |
| | | <FullLoading |