Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
chore: on example, use composable for route to fix highlight bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tewshi authored and kelsos committed Sep 4, 2023
1 parent 6f350d4 commit 986902b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions example/src/components/AppFootNav.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import { computed, toRefs, useCssModule } from 'vue';
import { get } from '@vueuse/shared';
import { useRoute } from 'vue-router/composables';
import { type SideNavLink } from '@/types';
import router from '@/router';
const props = defineProps<{
navigation: Array<{
Expand All @@ -11,15 +11,15 @@ const props = defineProps<{
}>;
}>();
const route = computed(() => router.currentRoute);
const route = useRoute();
const css = useCssModule();
const { navigation } = toRefs(props);
const links = computed(() =>
get(navigation).flatMap((section) => section.links),
);
const currentPage = computed(() =>
get(links).find((link) => link.to.name === route.value.name),
get(links).find((link) => link.to.name === route.name),
);
const currentPageIndex = computed(() => {
const current = get(currentPage);
Expand Down
6 changes: 3 additions & 3 deletions example/src/components/AppSideNav.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed, useCssModule } from 'vue';
import { useCssModule } from 'vue';
import { useRoute } from 'vue-router/composables';
import { type SideNavLink } from '@/types';
import router from '@/router';
defineProps<{
navigation: Array<{
Expand All @@ -10,7 +10,7 @@ defineProps<{
}>;
}>();
const route = computed(() => router.currentRoute);
const route = useRoute();
const css = useCssModule();
</script>

Expand Down

0 comments on commit 986902b

Please sign in to comment.