Skip to content

Commit

Permalink
doc(sidebar navigation): fix active navigation item
Browse files Browse the repository at this point in the history
  • Loading branch information
damjan.bursac committed Jul 12, 2024
1 parent 8f871fc commit 5013fd3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/docs/src/components/app/list/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router'
// Types
import type { RouteLocationRaw, RouteRecordRaw } from 'vue-router'
import type { Prop } from 'vue'
Expand All @@ -80,6 +82,8 @@
onClick?: () => void
}
const { path: currentRoutePath } = useRoute()
function generateApiItems (locale: string) {
return (generatedRoutes as RouteRecordRaw[])
.filter(route => route.path.includes(`${locale}/api/`))
Expand Down Expand Up @@ -117,6 +121,7 @@
emphasized: route?.meta?.emphasized ?? false,
to,
disabled: !route,
active: currentRoutePath === route?.path,
}
} else if (item.divider) {
return {
Expand Down

0 comments on commit 5013fd3

Please sign in to comment.