项目初始化

This commit is contained in:
2026-03-19 10:57:24 +08:00
commit ee94d420ad
3822 changed files with 582614 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<template>
<div :class="[prefixCls, getLayoutContentMode]" v-loading="getOpenPageLoading && getPageLoading">
<PageLayout />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import PageLayout from '@jeesite/core/layouts/page/index.vue';
import { useDesign } from '@jeesite/core/hooks/web/useDesign';
import { useRootSetting } from '@jeesite/core/hooks/setting/useRootSetting';
import { useTransitionSetting } from '@jeesite/core/hooks/setting/useTransitionSetting';
import { useContentViewHeight } from './useContentViewHeight';
export default defineComponent({
name: 'LayoutContent',
components: { PageLayout },
setup() {
const { prefixCls } = useDesign('layout-content');
const { getOpenPageLoading } = useTransitionSetting();
const { getLayoutContentMode, getPageLoading } = useRootSetting();
useContentViewHeight();
return {
prefixCls,
getOpenPageLoading,
getLayoutContentMode,
getPageLoading,
};
},
});
</script>
<style lang="less">
@prefix-cls: ~'jeesite-layout-content';
.@{prefix-cls} {
position: relative;
flex: 1 1 auto;
min-height: 0;
padding: 12px 12px 0;
background-color: @content-bg;
&.fixed {
width: 1200px;
margin: 0 auto;
}
&-loading {
position: absolute;
top: 200px;
z-index: @page-loading-z-index;
}
}
html[data-theme='dark'] {
.@{prefix-cls} {
background: #000;
}
}
</style>

View File

@@ -0,0 +1,17 @@
import type { InjectionKey, ComputedRef } from 'vue';
import { createContext, useContext } from '@jeesite/core/hooks/core/useContext';
export interface ContentContextProps {
contentHeight: ComputedRef<number>;
setPageHeight: (height: number) => Promise<void>;
}
const key: InjectionKey<ContentContextProps> = Symbol();
export function createContentContext(context: ContentContextProps) {
return createContext<ContentContextProps>(context, key, { native: true });
}
export function useContentContext() {
return useContext<ContentContextProps>(key);
}

View File

@@ -0,0 +1,42 @@
import { ref, computed, unref } from 'vue';
import { createPageContext } from '@jeesite/core/hooks/component/usePageContext';
import { useWindowSizeFn } from '@jeesite/core/hooks/event/useWindowSizeFn';
const headerHeightRef = ref(0);
const footerHeightRef = ref(0);
export function useLayoutHeight() {
function setHeaderHeight(val) {
headerHeightRef.value = val;
}
function setFooterHeight(val) {
footerHeightRef.value = val;
}
return { headerHeightRef, footerHeightRef, setHeaderHeight, setFooterHeight };
}
export function useContentViewHeight() {
const contentHeight = ref(window.innerHeight);
const pageHeight = ref(window.innerHeight);
const getViewHeight = computed(() => {
return unref(contentHeight) - unref(headerHeightRef) - unref(footerHeightRef) || 0;
});
useWindowSizeFn(
() => {
contentHeight.value = window.innerHeight;
},
100,
{ immediate: true },
);
async function setPageHeight(height: number) {
pageHeight.value = height;
}
createPageContext({
contentHeight: getViewHeight,
setPageHeight,
pageHeight,
});
}