2023-05-28 23:13:24 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { useStyleStore } from '@/stores/style.store';
|
|
|
|
|
|
|
|
const styleStore = useStyleStore();
|
|
|
|
const { isMenuCollapsed, isSmallScreen } = toRefs(styleStore);
|
|
|
|
const siderPosition = computed(() => (isSmallScreen.value ? 'absolute' : 'static'));
|
|
|
|
</script>
|
|
|
|
|
2022-04-15 12:21:09 +02:00
|
|
|
<template>
|
2022-04-15 23:10:47 +02:00
|
|
|
<n-layout has-sider>
|
|
|
|
<n-layout-sider
|
|
|
|
bordered
|
|
|
|
collapse-mode="width"
|
|
|
|
:collapsed-width="0"
|
|
|
|
:width="240"
|
|
|
|
:collapsed="isMenuCollapsed"
|
|
|
|
:show-trigger="false"
|
|
|
|
:native-scrollbar="false"
|
|
|
|
:position="siderPosition"
|
|
|
|
>
|
|
|
|
<slot name="sider" />
|
|
|
|
</n-layout-sider>
|
|
|
|
<n-layout class="content">
|
|
|
|
<slot name="content" />
|
2022-04-22 23:31:40 +02:00
|
|
|
<div v-show="isSmallScreen && !isMenuCollapsed" class="overlay" @click="isMenuCollapsed = true" />
|
2022-04-15 12:21:09 +02:00
|
|
|
</n-layout>
|
2022-04-15 23:10:47 +02:00
|
|
|
</n-layout>
|
2022-04-15 12:21:09 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.overlay {
|
2022-04-18 08:36:22 +02:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: #00000080;
|
|
|
|
cursor: pointer;
|
2022-04-15 12:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2022-04-18 08:36:22 +02:00
|
|
|
// background-color: #f1f5f9;
|
|
|
|
::v-deep(.n-layout-scroll-container) {
|
|
|
|
padding: 26px;
|
|
|
|
}
|
2022-04-15 12:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.n-layout {
|
2022-04-18 08:36:22 +02:00
|
|
|
height: 100vh;
|
2022-04-15 12:21:09 +02:00
|
|
|
}
|
2022-04-22 23:31:40 +02:00
|
|
|
</style>
|