2022-03-24 04:15:14 +00:00
|
|
|
<template>
|
2022-08-05 08:04:07 +00:00
|
|
|
<div class="g-container-layout" :class="classObj">
|
|
|
|
|
<div v-if="device === 'mobile' && !isCollapse" class="drawer-bg" @click="handleClickOutside" />
|
2022-08-24 09:53:08 +00:00
|
|
|
<sidebar class="sidebar-container" v-if="mode === 'vertical'" />
|
2022-08-05 08:04:07 +00:00
|
|
|
<div
|
|
|
|
|
class="main-container"
|
|
|
|
|
:class="{
|
|
|
|
|
hideSliderLayout: mode === 'horizontal',
|
|
|
|
|
}"
|
|
|
|
|
>
|
2022-03-24 04:15:14 +00:00
|
|
|
<u-header />
|
2022-08-24 10:53:05 +00:00
|
|
|
<div class="m-container-content" :class="{ 'app-main-hide-tag': !showTag }">
|
2022-08-24 09:53:08 +00:00
|
|
|
<u-main />
|
2022-04-30 13:19:10 +00:00
|
|
|
</div>
|
2022-03-24 04:15:14 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2022-08-30 11:17:40 +00:00
|
|
|
<script lang="ts" setup>
|
2022-08-05 08:04:07 +00:00
|
|
|
import { computed, defineComponent, ref } from 'vue'
|
2022-08-31 03:01:44 +00:00
|
|
|
import {useSettingStore} from "@/store/modules/setting"
|
2022-08-24 09:53:08 +00:00
|
|
|
import Sidebar from './Sidebar/index.vue'
|
|
|
|
|
import UHeader from './Header/index.vue'
|
|
|
|
|
import UMain from './Main/index.vue'
|
2022-08-30 11:17:40 +00:00
|
|
|
|
2022-08-05 08:04:07 +00:00
|
|
|
import { useResizeHandler } from './hooks/useResizeHandler'
|
2022-03-31 02:13:27 +00:00
|
|
|
|
2022-08-30 11:17:40 +00:00
|
|
|
const SettingStore = useSettingStore()
|
2022-03-24 04:15:14 +00:00
|
|
|
|
|
|
|
|
// 是否折叠
|
2022-08-05 08:04:07 +00:00
|
|
|
const isCollapse = computed(() => {
|
2022-09-02 13:28:40 +00:00
|
|
|
return !SettingStore.isCollapse
|
2022-03-24 04:15:14 +00:00
|
|
|
})
|
2022-08-05 08:04:07 +00:00
|
|
|
let { device } = useResizeHandler()
|
2022-08-30 11:17:40 +00:00
|
|
|
// 当屏幕切换的时候进行变换
|
2022-08-05 08:04:07 +00:00
|
|
|
const classObj = computed(() => {
|
2022-04-06 07:48:24 +00:00
|
|
|
return {
|
2022-08-30 11:17:40 +00:00
|
|
|
hideSidebar: !SettingStore.isCollapse,
|
|
|
|
|
openSidebar: SettingStore.isCollapse,
|
|
|
|
|
withoutAnimation: SettingStore.withoutAnimation,
|
2022-08-05 08:04:07 +00:00
|
|
|
mobile: device.value === 'mobile',
|
2022-04-06 07:48:24 +00:00
|
|
|
}
|
|
|
|
|
})
|
2022-08-30 11:17:40 +00:00
|
|
|
// 移动端点击
|
2022-08-05 08:04:07 +00:00
|
|
|
const handleClickOutside = () => {
|
2022-08-30 11:17:40 +00:00
|
|
|
SettingStore.closeSideBar({ withoutAnimation: false })
|
2022-04-06 07:48:24 +00:00
|
|
|
}
|
2022-08-30 11:17:40 +00:00
|
|
|
const showTag = computed(() => SettingStore.themeConfig.showTag)
|
2022-04-06 07:48:24 +00:00
|
|
|
|
2022-08-30 11:17:40 +00:00
|
|
|
const mode = computed(() => SettingStore.themeConfig.mode)
|
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-04-25 07:48:25 +00:00
|
|
|
//display: flex;
|
2022-03-24 04:15:14 +00:00
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2022-08-05 08:04:07 +00:00
|
|
|
.main-container {
|
2022-03-31 02:13:27 +00:00
|
|
|
//overflow: auto;
|
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
|
|
|
}
|
2022-08-05 08:04:07 +00:00
|
|
|
.m-container-content {
|
2022-06-10 03:01:39 +00:00
|
|
|
//padding: 20px;
|
2022-04-30 13:19:10 +00:00
|
|
|
/*background: #f6f8f9;*/
|
2022-06-10 03:01:39 +00:00
|
|
|
padding-top: 93px;
|
2022-06-16 06:48:48 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
|
height: 100vh;
|
2022-05-01 15:06:11 +00:00
|
|
|
position: relative;
|
2022-04-30 13:19:10 +00:00
|
|
|
}
|
2022-08-05 08:04:07 +00:00
|
|
|
.app-main-hide-tag {
|
2022-04-30 13:19:10 +00:00
|
|
|
padding-top: 80px;
|
|
|
|
|
}
|
2022-03-24 04:15:14 +00:00
|
|
|
</style>
|