diff --git a/UncertaintySourceArchive/src/components/NavBar.vue b/UncertaintySourceArchive/src/components/NavBar.vue index 313166a..908f1a1 100644 --- a/UncertaintySourceArchive/src/components/NavBar.vue +++ b/UncertaintySourceArchive/src/components/NavBar.vue @@ -23,6 +23,7 @@ }, name: 'Archive' }" + :alternative-link-names="['uncertainty']" /> import { router } from '@/router' import type { PropType } from 'vue' -import { RouterLink, type RouteLocationNamedRaw, type RouteParamsRaw } from 'vue-router' +import { + RouterLink, + type RouteLocationNamedRaw, + type RouteParamsRaw, + type RouteRecordName +} from 'vue-router' type Route = { link: RouteLocationNamedRaw @@ -42,12 +47,19 @@ const props = defineProps({ type: Array as PropType, required: false, default: () => [] + }, + alternativeLinkNames: { + type: Array, + required: false, + default: () => [] } }) function isCurrentRoute(route?: Route): boolean { const link = route ?? props.link - const sameName = router.currentRoute.value.name == link.link.name + const sameName = + router.currentRoute.value.name == link.link.name || + props.alternativeLinkNames.includes(router.currentRoute.value.name ?? '') if (link.link.params != undefined) { return ( sameName &&