All checks were successful
Build Docker Image / build (push) Successful in 4m34s
- /catalog/hubs/[id] — список товаров с графиками - /catalog/hubs/[id]/[productId] — страница товара с большим графиком и предложениями - CatalogBreadcrumbs — компонент хлебных крошек
52 lines
1.1 KiB
Vue
52 lines
1.1 KiB
Vue
<template>
|
|
<div class="breadcrumbs text-sm">
|
|
<ul>
|
|
<li v-for="(crumb, index) in breadcrumbs" :key="index">
|
|
<NuxtLink v-if="crumb.to" :to="crumb.to" class="hover:text-primary">
|
|
{{ crumb.label }}
|
|
</NuxtLink>
|
|
<span v-else class="text-base-content">{{ crumb.label }}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
hubId?: string
|
|
hubName?: string
|
|
productId?: string
|
|
productName?: string
|
|
}>()
|
|
|
|
const localePath = useLocalePath()
|
|
const { t } = useI18n()
|
|
|
|
const breadcrumbs = computed(() => {
|
|
const crumbs: Array<{ label: string; to?: string }> = []
|
|
|
|
// Hubs list
|
|
crumbs.push({
|
|
label: t('breadcrumbs.hubs', 'Hubs'),
|
|
to: localePath('/catalog/hubs')
|
|
})
|
|
|
|
// Hub
|
|
if (props.hubId) {
|
|
crumbs.push({
|
|
label: props.hubName || `#${props.hubId.slice(0, 8)}...`,
|
|
to: props.productId ? localePath(`/catalog/hubs/${props.hubId}`) : undefined
|
|
})
|
|
}
|
|
|
|
// Product
|
|
if (props.productId) {
|
|
crumbs.push({
|
|
label: props.productName || `#${props.productId.slice(0, 8)}...`
|
|
})
|
|
}
|
|
|
|
return crumbs
|
|
})
|
|
</script>
|