From 165b038153aa55f465a225d421616d32e472c889 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 20 八月 2024 18:16:58 +0800
Subject: [PATCH] 最新版本
---
admin/src/components/common/Menu.vue | 75 +++++++++++--------------------------
1 files changed, 23 insertions(+), 52 deletions(-)
diff --git a/admin/src/components/common/Menu.vue b/admin/src/components/common/Menu.vue
index 96422f6..15f7c56 100644
--- a/admin/src/components/common/Menu.vue
+++ b/admin/src/components/common/Menu.vue
@@ -1,19 +1,15 @@
<template>
<div class="menu" :class="{collapse: menuData.collapse}">
- <div class="logo">
- <div><img src="@/assets/logo.png"></div>
- <h1 :class="{hidden: menuData.collapse}">{{title}}</h1>
- </div>
<scrollbar>
-<!-- :default-openeds="defaultOpeneds"-->
<el-menu
ref="menu"
- :unique-opened="true"
:default-active="activeIndex"
text-color="#fff"
active-text-color="#fff"
:collapse="menuData.collapse"
+ :default-openeds="defaultOpeneds"
:collapse-transition="false"
+ unique-opened
@select="handleSelect"
>
<MenuItems v-for="menu in menuData.list" :key="menu.index" :menu="menu" :is-root-menu="true"/>
@@ -28,11 +24,6 @@
import Scrollbar from './Scrollbar'
export default {
name: 'Menu',
- data() {
- return {
- title: process.env.VUE_APP_TITLE
- }
- },
components: { Scrollbar, MenuItems },
computed: {
...mapState(['menuData']),
@@ -42,15 +33,20 @@
if (path.endsWith('/')) {
path = path.substring(0, path.length - 1)
}
- const menuConfig = this.__getMenuConfig(path, 'url', this.menuData.list)
+ const menuConfig = this.__getMenuConfig(path, 'index', this.menuData.list)
if (menuConfig == null) {
return null
+ } else {
+ this.$store.commit('pushtags', menuConfig)
}
+ // console.log(menuConfig.index);
return menuConfig.index
},
// 榛樿灞曞紑鐨勮彍鍗昳ndex
defaultOpeneds () {
- return this.menuData.list.map(menu => menu.index)
+ // return this.menuData.list.map(menu => menu.index)
+
+ return [this.menuData.list[0].index]
}
},
methods: {
@@ -59,18 +55,24 @@
const menuConfig = this.__getMenuConfig(menuIndex, 'index', this.menuData.list)
// 鎵句笉鍒伴〉闈�
try {
- require('@/views' + menuConfig.url)
+ require('@/views' + menuConfig.url)
} catch (e) {
this.$tip.error('鏈壘鍒伴〉闈㈡枃浠禓/views' + menuConfig.url + '.vue锛岃妫�鏌ヨ彍鍗曡矾寰勬槸鍚︽纭�')
+ return
}
// 鐐瑰嚮褰撳墠鑿滃崟涓嶅仛澶勭悊
- if (menuConfig.url === this.$route.path) {
+ if (menuConfig.url === this.$route.path && (menuConfig.params ==null || menuConfig.params==undefined || menuConfig.params=='' || menuConfig.params === this.$route.query.param)) {
return
}
if (menuConfig.url == null || menuConfig.url.trim().length === 0) {
return
}
- this.$router.push(menuConfig.url)
+ if(menuConfig.params!=null && menuConfig.params!=''){
+ this.$router.push({path:menuConfig.url,query:{index:menuConfig.index,param:menuConfig.params}})
+ }else{
+ this.$router.push(menuConfig.url)
+ }
+ this.$store.commit('pushtags', menuConfig)
},
// 鑾峰彇鑿滃崟閰嶇疆
__getMenuConfig (value, key, menus) {
@@ -97,37 +99,6 @@
height: 100%;
display: flex;
flex-direction: column;
- // LOGO
- .logo {
- height: 60px;
- flex-shrink: 0;
- line-height: 60px;
- overflow: hidden;
- display: flex;
- background: $primary-color - 20;
- padding: 0 16px;
- & > div {
- width: 32px;
- flex-shrink: 0;
- margin-right: 12px;
- img {
- width: 100%;
- flex-shrink: 0;
- vertical-align: middle;
- position: relative;
- top: -2px;
- }
- }
- h1 {
- font-size: 16px;
- font-weight: 500;
- transition: opacity ease .3s;
- overflow: hidden;
- &.hidden {
- opacity: 0;
- }
- }
- }
}
</style>
<style lang="scss">
@@ -141,11 +112,11 @@
background: $primary-color;
// 閫変腑鐘舵��
&.is-active {
- background: $primary-color - 40 !important;
+ background: $primary-color-sel !important;
}
// 鎮诞
&:hover {
- background-color: $primary-color - 12;
+ background-color: $primary-color-hover;
}
&:focus {
background: $primary-color;
@@ -158,13 +129,13 @@
}
&.is-active {
.el-submenu__title{
- background-color: $primary-color - 20;
+ background-color: $icon-background-color;
}
.el-menu .el-menu-item{
- background-color: $primary-color - 20;
+ background-color: $icon-background-color;
// 鎮诞
&:hover {
- background-color: $primary-color - 30;
+ background-color: $icon-background-color;
}
}
}
--
Gitblit v1.9.3