vben
authored
|
1
|
<template>
|
vben
authored
|
2
|
<Layout :class="prefixCls" v-bind="lockEvents">
|
vben
authored
|
3
|
<LayoutFeatures />
|
vben
authored
|
4
|
<LayoutHeader fixed v-if="getShowFullHeaderRef" />
|
vben
authored
|
5
|
<Layout :class="[layoutClass]">
|
sanmu
authored
|
6
|
<!-- 左侧菜单 -->
|
vben
authored
|
7
|
<LayoutSideBar v-if="getShowSidebar || getIsMobile" />
|
Vben
authored
|
8
|
<Layout :class="`${prefixCls}-main`">
|
sanmu
authored
|
9
|
<!-- 顶部header -->
|
vben
authored
|
10
|
<LayoutMultipleHeader />
|
sanmu
authored
|
11
|
<!-- 内容区域 -->
|
vben
authored
|
12
13
14
15
16
17
18
19
|
<LayoutContent />
<LayoutFooter />
</Layout>
</Layout>
</Layout>
</template>
<script lang="ts">
|
Vben
authored
|
20
|
import { defineComponent, computed, unref } from 'vue';
|
vben
authored
|
21
22
23
|
import { Layout } from 'ant-design-vue';
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
|
vben
authored
|
24
|
import LayoutHeader from './header/index.vue';
|
vben
authored
|
25
|
import LayoutContent from './content/index.vue';
|
vben
authored
|
26
27
|
import LayoutSideBar from './sider/index.vue';
import LayoutMultipleHeader from './header/MultipleHeader.vue';
|
vben
authored
|
28
29
30
31
|
import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
import { useDesign } from '/@/hooks/web/useDesign';
|
vben
authored
|
32
|
import { useLockPage } from '/@/hooks/web/useLockPage';
|
vben
authored
|
33
|
|
vben
authored
|
34
|
import { useAppInject } from '/@/hooks/web/useAppInject';
|
vben
authored
|
35
36
37
38
39
40
41
42
43
44
45
46
47
|
export default defineComponent({
name: 'DefaultLayout',
components: {
LayoutFeatures: createAsyncComponent(() => import('/@/layouts/default/feature/index.vue')),
LayoutFooter: createAsyncComponent(() => import('/@/layouts/default/footer/index.vue')),
LayoutHeader,
LayoutContent,
LayoutSideBar,
LayoutMultipleHeader,
Layout,
},
setup() {
|
vben
authored
|
48
|
const { prefixCls } = useDesign('default-layout');
|
vben
authored
|
49
|
const { getIsMobile } = useAppInject();
|
vben
authored
|
50
|
const { getShowFullHeaderRef } = useHeaderSetting();
|
vben
authored
|
51
|
const { getShowSidebar, getIsMixSidebar, getShowMenu } = useMenuSetting();
|
vben
authored
|
52
53
54
55
|
// Create a lock screen monitor
const lockEvents = useLockPage();
|
vben
authored
|
56
57
|
const layoutClass = computed(() => {
let cls: string[] = ['ant-layout'];
|
vben
authored
|
58
|
if (unref(getIsMixSidebar) || unref(getShowMenu)) {
|
vben
authored
|
59
60
61
62
|
cls.push('ant-layout-has-sider');
}
return cls;
});
|
Vben
authored
|
63
|
|
vben
authored
|
64
65
66
67
|
return {
getShowFullHeaderRef,
getShowSidebar,
prefixCls,
|
vben
authored
|
68
|
getIsMobile,
|
vben
authored
|
69
|
getIsMixSidebar,
|
Vben
authored
|
70
|
layoutClass,
|
vben
authored
|
71
|
lockEvents,
|
vben
authored
|
72
73
74
75
76
77
78
79
80
|
};
},
});
</script>
<style lang="less">
@prefix-cls: ~'@{namespace}-default-layout';
.@{prefix-cls} {
display: flex;
|
vben
authored
|
81
|
flex-direction: column;
|
vben
authored
|
82
83
|
width: 100%;
min-height: 100%;
|
Vben
authored
|
84
|
background-color: @content-bg;
|
vben
authored
|
85
86
87
88
|
> .ant-layout {
min-height: 100%;
}
|
vben
authored
|
89
|
|
Vben
authored
|
90
|
&-main {
|
vben
authored
|
91
|
width: 100%;
|
vben
authored
|
92
93
|
margin-left: 1px;
}
|
vben
authored
|
94
95
|
}
</style>
|