Commit d976c142 authored by yanzhengyang's avatar yanzhengyang

二级菜单、三级菜单选中样式bug修复

parent 26191ec6
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
ref="subMenu" ref="subMenu"
:index="resolvePath(item.path)" :index="resolvePath(item.path)"
teleported teleported
:default-active="activeMenu"
> >
<template v-if="item.meta" #title> <template v-if="item.meta" #title>
<svg-icon :icon-class="item.meta && item.meta.icon" /> <svg-icon :icon-class="item.meta && item.meta.icon" />
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
import { isExternal } from '@/utils/validate' import { isExternal } from '@/utils/validate'
import AppLink from './Link' import AppLink from './Link'
import { getNormalPath } from '@/utils/ruoyi' import { getNormalPath } from '@/utils/ruoyi'
import {useRoute} from "vue-router";
const props = defineProps({ const props = defineProps({
// route object // route object
...@@ -129,4 +131,23 @@ function hasTitle(title) { ...@@ -129,4 +131,23 @@ function hasTitle(title) {
return '' return ''
} }
} }
const route = useRoute()
const activeMenu = computed(() => {
const { meta, path } = route
if (meta.activeMenu) {
return meta.activeMenu
}
return path
})
</script> </script>
<style lang="scss" scoped>
.el-menu-item {
color: v-bind(getMenuTextColor);
&.is-active {
color: var(--menu-active-text, #409eff) !important;
background-color: #f4f4f9 !important;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment