add up directory button to nav
This commit is contained in:
@@ -1,9 +1,26 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const parentPath = computed(() => {
|
||||||
|
const segments = route.path.split("/").filter(Boolean);
|
||||||
|
if (segments.length == 1) {
|
||||||
|
return "/";
|
||||||
|
} else {
|
||||||
|
segments.pop();
|
||||||
|
return segments.length ? "/" + segments.join("/") : null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav class="flex-row">
|
<nav class="flex-row">
|
||||||
<RouterLink class="bdr-primary margin1" to="/"
|
<RouterLink class="bdr-2" to="/"><h1>HOME</h1></RouterLink>
|
||||||
><h1>HOME</h1></RouterLink
|
<RouterLink class="bdr-2" v-if="parentPath" :to="parentPath">
|
||||||
>
|
<h1>UP</h1>
|
||||||
<!-- <RouterLink to="/cv"><h1>CV</h1></RouterLink> -->
|
</RouterLink>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user