|
@@ -1,8 +1,10 @@
|
|
<template>
|
|
<template>
|
|
<div class="has-logo">
|
|
<div class="has-logo">
|
|
- <logo :collapse="isCollapse" />
|
|
|
|
|
|
+ <logo />
|
|
<div class="sidebar-box">
|
|
<div class="sidebar-box">
|
|
- <div v-for="item in sidebarRouters" :key="item.path" class="sidebar-box-item" @click="toMainMenu(item)">{{ item.menuName }}</div>
|
|
|
|
|
|
+ <div v-for="item in sidebarRouters" :key="item.path" class="sidebar-box-item" :class="{ active: item.path == active }" @click="toMainMenu(item)">
|
|
|
|
+ <item :icon="item.icon" :title="item.menuName" />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -10,31 +12,29 @@
|
|
<script>
|
|
<script>
|
|
import { mapGetters, mapState } from 'vuex'
|
|
import { mapGetters, mapState } from 'vuex'
|
|
import Logo from './Sidebar/Logo'
|
|
import Logo from './Sidebar/Logo'
|
|
-import variables from '@/assets/styles/variables.scss'
|
|
|
|
|
|
+import Item from './Sidebar/Item'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- components: { Logo },
|
|
|
|
|
|
+ components: { Logo, Item },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ active: sessionStorage.getItem('sidebarActive') || 'index'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
...mapState(['settings']),
|
|
...mapState(['settings']),
|
|
...mapGetters(['sidebarRouters', 'sidebar']),
|
|
...mapGetters(['sidebarRouters', 'sidebar']),
|
|
- activeMenu() {
|
|
|
|
- const route = this.$route
|
|
|
|
- const { meta, path } = route
|
|
|
|
- // if set path, the sidebar will highlight the path you set
|
|
|
|
- if (meta.activeMenu) {
|
|
|
|
- return meta.activeMenu
|
|
|
|
- }
|
|
|
|
- return path
|
|
|
|
- },
|
|
|
|
- variables() {
|
|
|
|
- return variables
|
|
|
|
- },
|
|
|
|
isCollapse() {
|
|
isCollapse() {
|
|
return !this.sidebar.opened
|
|
return !this.sidebar.opened
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
toMainMenu(item) {
|
|
toMainMenu(item) {
|
|
|
|
+ if (this.$route.query.id == item.menuId) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.active = item.path
|
|
|
|
+ sessionStorage.setItem('sidebarActive', item.path)
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
path: '/mainMenu',
|
|
path: '/mainMenu',
|
|
query: {
|
|
query: {
|
|
@@ -57,6 +57,7 @@ export default {
|
|
text-align: center;
|
|
text-align: center;
|
|
line-height: 49px;
|
|
line-height: 49px;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
+ user-select: none;
|
|
border-bottom: 1px dashed #535559;
|
|
border-bottom: 1px dashed #535559;
|
|
&:hover {
|
|
&:hover {
|
|
background-color: #535559;
|
|
background-color: #535559;
|