|
|
@@ -1,54 +1,57 @@
|
|
1
|
1
|
<template>
|
|
2
|
|
- <div :class="{'has-logo':showLogo}">
|
|
3
|
|
- <logo v-if="showLogo" :collapse="isCollapse" />
|
|
4
|
|
- <el-scrollbar wrap-class="scrollbar-wrapper">
|
|
5
|
|
- <el-menu
|
|
6
|
|
- :default-active="activeMenu"
|
|
7
|
|
- :collapse="isCollapse"
|
|
8
|
|
- :background-color="variables.menuBg"
|
|
9
|
|
- :text-color="variables.menuText"
|
|
10
|
|
- :unique-opened="true"
|
|
11
|
|
- :active-text-color="variables.menuActiveText"
|
|
12
|
|
- :collapse-transition="false"
|
|
13
|
|
- mode="vertical"
|
|
14
|
|
- >
|
|
15
|
|
- <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
|
|
16
|
|
- </el-menu>
|
|
17
|
|
- </el-scrollbar>
|
|
18
|
|
- </div>
|
|
|
2
|
+ <div :class="{'has-logo':showLogo}">
|
|
|
3
|
+ <logo v-if="showLogo" :collapse="isCollapse" />
|
|
|
4
|
+ <el-scrollbar wrap-class="scrollbar-wrapper">
|
|
|
5
|
+ <el-menu
|
|
|
6
|
+ :default-active="activeMenu"
|
|
|
7
|
+ :collapse="isCollapse"
|
|
|
8
|
+ :background-color="variables.menuBg"
|
|
|
9
|
+ :text-color="variables.menuText"
|
|
|
10
|
+ :unique-opened="true"
|
|
|
11
|
+ :active-text-color="settings.theme"
|
|
|
12
|
+ :collapse-transition="false"
|
|
|
13
|
+ mode="vertical"
|
|
|
14
|
+ >
|
|
|
15
|
+ <sidebar-item
|
|
|
16
|
+ v-for="(route, index) in permission_routes"
|
|
|
17
|
+ :key="route.path + index"
|
|
|
18
|
+ :item="route"
|
|
|
19
|
+ :base-path="route.path"
|
|
|
20
|
+ />
|
|
|
21
|
+ </el-menu>
|
|
|
22
|
+ </el-scrollbar>
|
|
|
23
|
+ </div>
|
|
19
|
24
|
</template>
|
|
20
|
25
|
|
|
21
|
26
|
<script>
|
|
22
|
|
-import { mapGetters } from 'vuex'
|
|
23
|
|
-import Logo from './Logo'
|
|
24
|
|
-import SidebarItem from './SidebarItem'
|
|
25
|
|
-import variables from '@/assets/styles/variables.scss'
|
|
|
27
|
+import { mapGetters, mapState } from "vuex";
|
|
|
28
|
+import Logo from "./Logo";
|
|
|
29
|
+import SidebarItem from "./SidebarItem";
|
|
|
30
|
+import variables from "@/assets/styles/variables.scss";
|
|
26
|
31
|
|
|
27
|
32
|
export default {
|
|
28
|
|
- components: { SidebarItem, Logo },
|
|
29
|
|
- computed: {
|
|
30
|
|
- ...mapGetters([
|
|
31
|
|
- 'permission_routes',
|
|
32
|
|
- 'sidebar'
|
|
33
|
|
- ]),
|
|
34
|
|
- activeMenu() {
|
|
35
|
|
- const route = this.$route
|
|
36
|
|
- const { meta, path } = route
|
|
37
|
|
- // if set path, the sidebar will highlight the path you set
|
|
38
|
|
- if (meta.activeMenu) {
|
|
39
|
|
- return meta.activeMenu
|
|
40
|
|
- }
|
|
41
|
|
- return path
|
|
42
|
|
- },
|
|
43
|
|
- showLogo() {
|
|
44
|
|
- return this.$store.state.settings.sidebarLogo
|
|
45
|
|
- },
|
|
46
|
|
- variables() {
|
|
47
|
|
- return variables
|
|
48
|
|
- },
|
|
49
|
|
- isCollapse() {
|
|
50
|
|
- return !this.sidebar.opened
|
|
|
33
|
+ components: { SidebarItem, Logo },
|
|
|
34
|
+ computed: {
|
|
|
35
|
+ ...mapState(["settings"]),
|
|
|
36
|
+ ...mapGetters(["permission_routes", "sidebar"]),
|
|
|
37
|
+ activeMenu() {
|
|
|
38
|
+ const route = this.$route;
|
|
|
39
|
+ const { meta, path } = route;
|
|
|
40
|
+ // if set path, the sidebar will highlight the path you set
|
|
|
41
|
+ if (meta.activeMenu) {
|
|
|
42
|
+ return meta.activeMenu;
|
|
|
43
|
+ }
|
|
|
44
|
+ return path;
|
|
|
45
|
+ },
|
|
|
46
|
+ showLogo() {
|
|
|
47
|
+ return this.$store.state.settings.sidebarLogo;
|
|
|
48
|
+ },
|
|
|
49
|
+ variables() {
|
|
|
50
|
+ return variables;
|
|
|
51
|
+ },
|
|
|
52
|
+ isCollapse() {
|
|
|
53
|
+ return !this.sidebar.opened;
|
|
|
54
|
+ }
|
|
51
|
55
|
}
|
|
52
|
|
- }
|
|
53
|
|
-}
|
|
|
56
|
+};
|
|
54
|
57
|
</script>
|