menu.vue
2.97 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<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;
});
let menuData = computed(() => {
let res = store.family.menuStore().menuList;
return res;
});
</script>
<template>
<el-scrollbar wrap-class="scrollbar-wrapper">
<!-- {{menuData}} -->
<el-menu
default-active="2"
:background-color="styleData.menuBg"
:text-color="styleData.menuText"
:active-text-color="styleData.menuActiveText"
class="el-menu-vertical-demo"
:router="true"
:collapse-transition="false"
:collapse="store.family.appStore().isCollapse"
>
<el-sub-menu
:index="index + ''"
v-for="(item, index) in menuData"
:key="index"
>
<template #title>
<el-icon><location /></el-icon>
<span>{{ item.name }}假菜单</span>
</template>
<el-menu-item-group v-for="(ele, i) in item.menuList" :key="i">
<el-menu-item :index="ele.path ? ele.path : '/'">{{
ele.name
}}</el-menu-item>
</el-menu-item-group>
</el-sub-menu>
<el-sub-menu index="11">
<template #title>
<el-icon><location /></el-icon>
<span>物业管理真菜单可点</span>
</template>
<el-menu-item-group>
<el-menu-item index="/property">物业列表</el-menu-item>
</el-menu-item-group>
</el-sub-menu>
<el-sub-menu index="12">
<template #title>
<el-icon><location /></el-icon>
<span>小区管理真菜单可点</span>
</template>
<el-menu-item-group>
<el-menu-item index="/community">小区管理</el-menu-item>
<el-menu-item index="/housekeeper">楼宇管理</el-menu-item>
<el-menu-item index="/houses">房屋管理</el-menu-item>
</el-menu-item-group>
</el-sub-menu>
<el-sub-menu index="13">
<template #title>
<el-icon><location /></el-icon>
<span>用户管理真菜单可点</span>
</template>
<el-menu-item-group>
<el-menu-item index="/user">用户列表</el-menu-item>
</el-menu-item-group>
</el-sub-menu>
<el-sub-menu index="14">
<template #title>
<el-icon><location /></el-icon>
<span>角色管理真菜单可点</span>
</template>
<el-menu-item-group>
<el-menu-item index="/role">角色列表</el-menu-item>
</el-menu-item-group>
</el-sub-menu>
</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>