Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit c7d443a

Browse files
authored
feat: dynamic navItem opening based on route path (#118)
1 parent 18747fd commit c7d443a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/ContentNavItem.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const paddingLeft = computed(() => `${0.5 + props.level * 0.8}rem`)
2525
<template>
2626
<div class="content-nav-item">
2727
<template v-if="resolved.children?.length">
28-
<details>
28+
<details :open="$route.path.includes(resolved._path)">
2929
<summary>
3030
<div
3131
flex="~ gap-1 items-center" cursor-pointer select-none px1 py0.5
@@ -52,6 +52,7 @@ const paddingLeft = computed(() => `${0.5 + props.level * 0.8}rem`)
5252
:to="resolved._path"
5353
px1 py0.5
5454
:style="{ paddingLeft }"
55+
:class="{ 'text-primary bg-active': resolved._path === $route.path }"
5556
flex="~ gap-1 items-center"
5657
hover="text-primary bg-active "
5758
@click="ui.isContentDropdownShown = false"

0 commit comments

Comments
 (0)