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