Files
pqs-9100_client/frontend/src/layouts/components/Menu/SubMenu.vue

99 lines
2.6 KiB
Vue
Raw Normal View History

2024-08-22 11:27:06 +08:00
<template>
<template v-for="subItem in menuList" :key="subItem.path">
<el-sub-menu v-if="subItem.children?.length" :index="subItem.path">
<template #title>
<el-icon>
<component :is="subItem.meta.icon"></component>
</el-icon>
<span class="sle">{{ subItem.meta.title }}</span>
</template>
<SubMenu :menu-list="subItem.children" />
</el-sub-menu>
<el-menu-item v-else :index="subItem.path" @click="handleClickMenu(subItem)">
<el-icon>
<component :is="subItem.meta.icon"></component>
</el-icon>
<template #title>
<span class="sle">{{ subItem.meta.title }}</span>
</template>
</el-menu-item>
</template>
</template>
<script setup lang="ts">
2025-07-21 13:47:56 +08:00
import { onBeforeMount } from "vue";
2024-08-22 11:27:06 +08:00
import { useRouter } from "vue-router";
defineProps<{ menuList: Menu.MenuOptions[] }>();
const router = useRouter();
const handleClickMenu = (subItem: Menu.MenuOptions) => {
2025-08-05 10:37:40 +08:00
//console.log('1456----------------',subItem);
2024-08-22 11:27:06 +08:00
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
router.push(subItem.path);
};
2025-07-21 13:47:56 +08:00
2024-08-22 11:27:06 +08:00
</script>
<style lang="scss">
.el-sub-menu .el-sub-menu__title:hover {
2024-08-22 16:36:00 +08:00
// color: var(--el-menu-hover-text-color) !important;
// background-color: transparent !important;
color: #fff !important;//一级导航文字选中颜色
2025-03-17 13:17:12 +08:00
//background-color: #5274a5 !important; //一级导航选中背景色
2025-03-19 10:26:41 +08:00
background-color: var(--el-color-primary-light-3) !important;
2025-03-17 13:17:12 +08:00
2024-08-22 11:27:06 +08:00
}
.el-menu--collapse {
.is-active {
.el-sub-menu__title {
color: #ffffff !important;
2024-08-22 16:36:00 +08:00
// background-color: var(--el-color-primary) !important;
2025-03-17 13:17:12 +08:00
//background-color: #5274a5 !important;
2025-03-19 10:26:41 +08:00
background-color: var(--el-color-primary-light-3) !important;
2025-03-17 13:17:12 +08:00
2024-08-22 16:36:00 +08:00
border-bottom: 0 !important;
2024-08-22 11:27:06 +08:00
}
}
}
.el-menu-item {
&:hover {
color: var(--el-menu-hover-text-color);
}
&.is-active {
2024-08-22 16:36:00 +08:00
// color: var(--el-menu-active-color) !important;
// background-color: var(--el-menu-active-bg-color) !important;
color: #fff !important;//一级导航文字选中颜色
2025-03-17 13:17:12 +08:00
//background-color: #5274a5 !important; //一级导航选中背景色
2025-03-19 10:26:41 +08:00
background-color: var(--el-color-primary-light-3) !important;
2025-03-17 13:17:12 +08:00
2024-08-22 11:27:06 +08:00
&::before {
position: absolute;
top: 0;
bottom: 0;
width: 4px;
content: "";
background-color: var(--el-color-primary);
}
}
}
.vertical,
.classic,
.transverse {
.el-menu-item {
&.is-active {
&::before {
left: 0;
}
}
}
}
.columns {
.el-menu-item {
&.is-active {
&::before {
right: 0;
}
}
}
}
</style>