Merge pull request #3704 from feitianbubu/feat/sidebar-logo-home-link

feat: 点击侧边栏 Logo/站点名返回首页
This commit is contained in:
Wesley Liddick
2026-07-06 10:12:15 +08:00
committed by GitHub
+14 -4
View File
@@ -9,13 +9,21 @@
<!-- Logo/Brand -->
<div class="sidebar-header" :class="{ 'sidebar-header-collapsed': sidebarCollapsed }">
<!-- Custom Logo or Default Logo -->
<div class="sidebar-logo flex h-9 w-9 items-center justify-center overflow-hidden rounded-xl shadow-glow">
<router-link
:to="homePath"
class="sidebar-logo flex h-9 w-9 items-center justify-center overflow-hidden rounded-xl shadow-glow transition-opacity hover:opacity-80"
@click="handleMenuItemClick(homePath)"
>
<img v-if="settingsLoaded" :src="siteLogo || '/logo.png'" alt="Logo" class="h-full w-full object-contain" />
</div>
</router-link>
<div class="sidebar-brand" :class="{ 'sidebar-brand-collapsed': sidebarCollapsed }" :aria-hidden="sidebarCollapsed ? 'true' : 'false'">
<span class="sidebar-brand-title text-lg font-bold text-gray-900 dark:text-white">
<router-link
:to="homePath"
class="sidebar-brand-title text-lg font-bold text-gray-900 transition-colors hover:text-primary-600 dark:text-white dark:hover:text-primary-400"
@click="handleMenuItemClick(homePath)"
>
{{ siteName }}
</span>
</router-link>
<!-- Version Badge -->
<VersionBadge :version="siteVersion" />
</div>
@@ -238,6 +246,8 @@ const mobileOpen = computed(() => appStore.mobileOpen)
const isAdmin = computed(() => authStore.isAdmin)
const isDark = ref(document.documentElement.classList.contains('dark'))
const homePath = computed(() => (isAdmin.value ? '/admin/dashboard' : '/dashboard'))
// Track which parent nav groups are expanded
const expandedGroups = ref<Set<string>>(new Set())