21 lines
579 B
Vue
21 lines
579 B
Vue
<template>
|
||
<span class="truncate">
|
||
<template v-for="(dir, i) in segments.dirs" :key="i">
|
||
<span class="text-muted">{{ dir }}</span><span class="mx-1.5 text-[17px] font-semibold text-text">›</span>
|
||
</template>
|
||
<span class="font-semibold text-text">{{ segments.file }}</span>
|
||
</span>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { computed } from 'vue'
|
||
|
||
const props = defineProps<{ path: string }>()
|
||
|
||
const segments = computed(() => {
|
||
const parts = props.path.split('/')
|
||
const file = parts.pop() ?? props.path
|
||
return { dirs: parts, file }
|
||
})
|
||
</script>
|