Skip to content

Commit bb2eb54

Browse files
committed
highlight drawer item based on route
1 parent a0a94c1 commit bb2eb54

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/components/TheDrawer.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { computed, ref } from "vue";
77
88
const router = useRouter();
99
const route = useRoute();
10-
const selectedId = ref(0);
1110
1211
const expanded = useLocalStorage("vue-forge-drawer-expanded", true);
1312
const expandedIcon = computed(() =>
@@ -43,7 +42,7 @@ const items = computed(() =>
4342
action: () => (expanded.value = !expanded.value),
4443
},
4544
},
46-
].map((item, index) => ({
45+
].map((item) => ({
4746
...item,
4847
selected: route.path === item.data.path,
4948
}))
@@ -52,7 +51,6 @@ const items = computed(() =>
5251
function onSelect({ itemIndex }: { itemIndex: number }) {
5352
const item = items.value[itemIndex];
5453
if (!item) return;
55-
selectedId.value = itemIndex;
5654
if (item.data.path) router.push(item.data.path);
5755
if (typeof item.data.action === "function") item.data.action();
5856
}

0 commit comments

Comments
 (0)