This commit is contained in:
hrx 2025-09-24 13:56:00 +08:00
parent 9b0f0282d4
commit 9d7612c647
2 changed files with 43 additions and 10 deletions

View File

@ -5,11 +5,25 @@
<Logo v-if="showLogo" :collapse="isCollapse" />
<!-- 菜单 -->
<happy-scroll color="rgba(0,0,0,0.5)" size="5" class="menu-scroll-container">
<el-menu :collapse="isCollapse" :background-color="variables.menuBg" :text-color="variables.menuText"
:unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false"
:default-active="$route.path" mode="vertical" class="el-menu-vertical">
<sidebar-item v-for="(route, index) in permission_routes" :key="index" :item="route"
:base-path="route.path" />
<el-menu
:collapse="isCollapse"
:background-color="variables.menuBg"
:text-color="variables.menuText"
:unique-opened="true"
:active-text-color="variables.menuActiveText"
:collapse-transition="false"
:default-active="$route.path"
mode="vertical"
class="el-menu-vertical"
>
<!-- 循环 filteredRoutes -->
<sidebar-item
v-for="(route, index) in filteredRoutes"
:key="index"
:item="route"
:base-path="route.path"
/>
</el-menu>
</happy-scroll>
</div>
@ -26,8 +40,11 @@ export default {
name: "Sidebar",
data() {
return {
role: ''
}
role: '',
homePageRouteIdentifier: (route) => {
return route.name === 'homePage';
}
};
},
components: { SidebarItem, Logo },
computed: {
@ -41,6 +58,13 @@ export default {
isCollapse() {
return !this.sidebar.opened;
},
// --- ---
filteredRoutes() {
if (!this.permission_routes) {
return [];
}
return this.permission_routes.filter(route => !this.homePageRouteIdentifier(route));
}
},
methods: {
@ -106,3 +130,6 @@ export default {
}
}
</style>

View File

@ -1,10 +1,12 @@
<template>
<div class="mainBox">
<!-- 粘性导航组件 -->
<HomePageSticky
ref="stickyNav"
:sections="stickySections"
@navigate="handleNavigation"
:show-threshold-element-selector="'.tagUl'"
:show-offset="0"
></HomePageSticky>
<div id="banner" class="banner">
@ -15,6 +17,7 @@
</span>
<span class="rightText"> 您身边的AI管家</span>
</span>
<!-- 当滚动到这个元素位置时显示粘性导航 -->
<ul style="margin-top: 50px" class="tagUl">
<li> AI </li>
</ul>
@ -508,8 +511,6 @@ export default Vue.extend({
</script>
<style scoped lang="scss">
//
.slide-fade-enter-active {
transition: all 0.3s ease;
@ -1349,5 +1350,10 @@ export default Vue.extend({
position: sticky;
top: 0px;
z-index: 999;
}
</style>