2022-03-24 04:15:14 +00:00
|
|
|
<template>
|
2022-08-05 08:04:07 +00:00
|
|
|
<div class="g-container-layout" :class="classObj">
|
2023-02-22 13:00:10 +00:00
|
|
|
<!-- <Mobile/>-->
|
|
|
|
|
<!-- <LayoutVertical v-if="device === 'mobile'"/>-->
|
|
|
|
|
<!-- <component :is="LayoutComponents[themeConfig.mode]" v-else/>-->
|
|
|
|
|
<!-- <Theme />-->
|
|
|
|
|
<LayoutColumns/>
|
2022-03-24 04:15:14 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2022-08-30 11:17:40 +00:00
|
|
|
<script lang="ts" setup>
|
2022-11-26 06:31:35 +00:00
|
|
|
import { computed,watch } from 'vue'
|
|
|
|
|
import Theme from '@/components/Theme/index.vue'
|
|
|
|
|
import Mobile from './components/Mobile/index.vue'
|
2022-08-31 03:01:44 +00:00
|
|
|
import {useSettingStore} from "@/store/modules/setting"
|
2022-08-05 08:04:07 +00:00
|
|
|
import { useResizeHandler } from './hooks/useResizeHandler'
|
2022-11-26 06:31:35 +00:00
|
|
|
import LayoutVertical from './LayoutVertical/index.vue'
|
|
|
|
|
import LayoutHorizontal from './LayoutHorizontal/index.vue'
|
2023-02-22 13:00:10 +00:00
|
|
|
import LayoutColumns from './LayoutColumns/index.vue'
|
2022-03-31 02:13:27 +00:00
|
|
|
|
2022-09-12 12:31:21 +00:00
|
|
|
const SettingStore = useSettingStore()
|
2022-11-26 06:31:35 +00:00
|
|
|
const themeConfig = computed(() => SettingStore.themeConfig)
|
|
|
|
|
const LayoutComponents = {
|
|
|
|
|
horizontal: LayoutHorizontal,
|
|
|
|
|
vertical: LayoutVertical,
|
2023-02-22 13:00:10 +00:00
|
|
|
columns: LayoutColumns,
|
2022-11-26 06:31:35 +00:00
|
|
|
};
|
2022-03-24 04:15:14 +00:00
|
|
|
|
2022-09-12 12:31:21 +00:00
|
|
|
// 是否折叠
|
|
|
|
|
const isCollapse = computed(() => {
|
|
|
|
|
return !SettingStore.isCollapse
|
|
|
|
|
})
|
|
|
|
|
let { device } = useResizeHandler()
|
2022-11-26 06:31:35 +00:00
|
|
|
|
|
|
|
|
watch(()=>device.value,(val)=>{
|
|
|
|
|
let vertical = val==='mobile'?'vertical':themeConfig.value.mode
|
|
|
|
|
const body = document.body as HTMLElement;
|
|
|
|
|
body.setAttribute("class", `layout-${vertical}`);
|
|
|
|
|
},{
|
|
|
|
|
immediate:true
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2022-09-12 12:31:21 +00:00
|
|
|
// 当屏幕切换的时候进行变换
|
|
|
|
|
const classObj = computed(() => {
|
|
|
|
|
return {
|
|
|
|
|
hideSidebar: !SettingStore.isCollapse,
|
|
|
|
|
openSidebar: SettingStore.isCollapse,
|
|
|
|
|
withoutAnimation: SettingStore.withoutAnimation,
|
|
|
|
|
mobile: device.value === 'mobile',
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-04-06 07:48:24 +00:00
|
|
|
|
2022-03-24 04:15:14 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-08-05 08:04:07 +00:00
|
|
|
.g-container-layout {
|
2022-03-24 04:15:14 +00:00
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2022-08-05 08:04:07 +00:00
|
|
|
.main-container {
|
2022-03-24 04:15:14 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex: 1;
|
2022-03-28 10:32:20 +00:00
|
|
|
box-sizing: border-box;
|
2022-08-05 08:04:07 +00:00
|
|
|
flex-direction: column;
|
2022-03-24 04:15:14 +00:00
|
|
|
}
|
2022-04-06 07:48:24 +00:00
|
|
|
&.mobile.openSidebar {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-05 08:04:07 +00:00
|
|
|
.sidebar-container {
|
2022-04-19 01:47:14 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
2022-04-06 07:48:24 +00:00
|
|
|
.drawer-bg {
|
|
|
|
|
background: #000;
|
|
|
|
|
opacity: 0.3;
|
|
|
|
|
width: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
height: 100%;
|
|
|
|
|
position: absolute;
|
2022-09-02 13:28:40 +00:00
|
|
|
z-index: 90;
|
2022-03-24 04:15:14 +00:00
|
|
|
}
|
|
|
|
|
</style>
|