index.vue
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<n-layout-sider
class="go-project-sider"
bordered
collapse-mode="width"
show-trigger="bar"
:collapsed="collapsed"
:native-scrollbar="false"
:collapsed-width="getAsideCollapsedWidth"
:width="asideWidth"
@collapse="collapsed = true"
@expand="collapsed = false"
>
<div class="go-project-sider-flex">
<aside>
<n-menu
:options="menuOptions"
:collapsed-width="getAsideCollapsedWidth"
:collapsed-icon-size="22"
default-value="three-project"
></n-menu>
</aside>
</div>
</n-layout-sider>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted, toRefs } from 'vue'
import { asideWidth } from '@/settings/designSetting'
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
import { menuOptionsInit } from './menu'
const collapsed = ref<boolean>(false)
const { getAsideCollapsedWidth } = toRefs(useSettingStore())
const menuOptions = menuOptionsInit()
const watchWidth = () => {
const Width = document.body.clientWidth
if (Width <= 950) {
collapsed.value = true
} else collapsed.value = false
}
onMounted(() => {
window.addEventListener('resize', watchWidth)
})
onUnmounted(() => {
window.removeEventListener('resize', watchWidth)
})
</script>
<style lang="scss" scoped>
$siderHeight: 100vh;
@include go(project) {
&-sider {
@include fetch-bg-color('aside-background-color');
&-top {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
margin-top: 30px;
margin-bottom: 20px;
}
&-flex {
display: flex;
flex-direction: column;
justify-content: space-between;
height: $siderHeight;
}
}
&-layout-sider {
height: $siderHeight;
}
.content-top {
top: $--header-height;
margin-top: 1px;
}
}
</style>