menu.vue
2.12 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
<script setup lang="ts">
/**
* 公共布局侧导航
* @module Menu
* @author Tengxi
*/
import { ref, computed } from "vue";
import * as store from "@/pinia/index";
import styles from '@/style/global.module.scss';
// TIP 使用element plus ICON
import {
Location,
Document,
Menu as IconMenu,
Setting,
} from "@element-plus/icons-vue";
// TIP 获取scss样式变量
let styleData = computed(()=>{
return styles
});
</script>
<template>
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-menu
default-active="2"
:background-color="styleData.menuBg"
:text-color="styleData.menuText"
:active-text-color="styleData.menuActiveText"
class="el-menu-vertical-demo"
:collapse-transition="false"
:collapse="store.family.appStore().isCollapse"
>
<el-sub-menu index="1">
<template #title>
<el-icon><location /></el-icon>
<span>Navigator One</span>
</template>
<el-menu-item-group>
<template #title><span>Group One</span></template>
<el-menu-item index="1-1">item one</el-menu-item>
<el-menu-item index="1-2">item two</el-menu-item>
</el-menu-item-group>
<el-menu-item-group title="Group Two">
<el-menu-item index="1-3">item three</el-menu-item>
</el-menu-item-group>
<el-sub-menu index="1-4">
<template #title><span>item four</span></template>
<el-menu-item index="1-4-1">item one</el-menu-item>
</el-sub-menu>
</el-sub-menu>
<el-menu-item index="2">
<el-icon><icon-menu /></el-icon>
<template #title>Navigator Two</template>
</el-menu-item>
<el-menu-item index="3" disabled>
<el-icon><document /></el-icon>
<template #title>Navigator Three</template>
</el-menu-item>
<el-menu-item index="4">
<el-icon><setting /></el-icon>
<template #title>Navigator Four</template>
</el-menu-item>
</el-menu>
</el-scrollbar>
</template>
<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
width: $sideBarWidth;
min-height: calc(100vh - 60px);
}
</style>