fix(fe): refine sidebar section toggle to avoid unnecessary page re-navigation

This commit is contained in:
2026-08-15 20:44:38 +09:00
parent 385d10d2cb
commit 232a0641cb
+2 -5
View File
@@ -102,15 +102,12 @@ watch(() => route.path, (newPath) => {
const isActive = (path: string) => route.path === path
const toggleSection = (itemId: string, defaultPath?: string) => {
const toggleSection = (itemId: string) => {
if (expandedSections.value.has(itemId)) {
expandedSections.value.delete(itemId)
} else {
expandedSections.value.add(itemId)
}
if (defaultPath) {
router.push(defaultPath)
}
}
const isSectionExpanded = (itemId: string) => expandedSections.value.has(itemId)
@@ -160,7 +157,7 @@ const sidebarClass = computed(() => ({
},
]"
:title="item.label"
@click="item.children ? toggleSection(item.id, item.path) : handleMenuClick(item.path)"
@click="item.children ? toggleSection(item.id) : handleMenuClick(item.path)"
>
<span class="ks-sidebar__icon">{{ item.icon }}</span>
<span class="ks-sidebar__label">{{ item.label }}</span>