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

View File

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