fix: 恢复侧边栏原生收缩触发器

This commit is contained in:
2026-05-18 16:45:59 +08:00
parent 028d2d42cc
commit 31dd478240
3 changed files with 11 additions and 32 deletions
+4 -7
View File
@@ -7,7 +7,8 @@
:collapsed="sidebarCollapsed"
:collapsed-width="64"
:width="220"
@update:collapsed="sidebarCollapsed = $event"
show-trigger="bar"
@update:collapsed="handleSidebarCollapsed"
>
<div class="brand">
<div class="brand-mark">📊</div>
@@ -32,9 +33,6 @@
<n-layout>
<n-layout-header bordered class="topbar page-header">
<button class="sidebar-toggle" type="button" title="展开/收起侧边栏" @click="toggleSidebar">
<n-icon><MenuOutline /></n-icon>
</button>
<div class="page-header-content">
<h1>{{ currentTitle }}</h1>
<span v-if="pageSubtitle" class="page-subtitle" :title="pageSubtitle">{{ pageSubtitle }}</span>
@@ -92,7 +90,6 @@ import {
ConstructOutline,
FileTrayFullOutline,
LogOutOutline,
MenuOutline,
MoonOutline,
PowerOutline,
ServerOutline,
@@ -173,8 +170,8 @@ function logout() {
token.value = '';
}
function toggleSidebar() {
sidebarCollapsed.value = !sidebarCollapsed.value;
function handleSidebarCollapsed(value: boolean) {
sidebarCollapsed.value = value;
localStorage.setItem('sidebarCollapsed', sidebarCollapsed.value ? 'true' : 'false');
}