Merge pull request #3572 from primefaces/issue-3570

Breadcrumb: separator fix for home prop null cases
pull/3578/head
Tuğçe Küçükoğlu 2023-01-23 11:57:39 +03:00 committed by GitHub
commit 3acadd5ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -2,8 +2,8 @@
<nav class="p-breadcrumb p-component"> <nav class="p-breadcrumb p-component">
<ol class="p-breadcrumb-list"> <ol class="p-breadcrumb-list">
<BreadcrumbItem v-if="home" :item="home" class="p-breadcrumb-home" :exact="exact" /> <BreadcrumbItem v-if="home" :item="home" class="p-breadcrumb-home" :exact="exact" />
<template v-for="item of model" :key="item.label"> <template v-for="(item, i) of model" :key="item.label">
<li class="p-menuitem-separator"> <li v-if="isHomeExist(i)" class="p-menuitem-separator">
<span class="pi pi-chevron-right" aria-hidden="true"></span> <span class="pi pi-chevron-right" aria-hidden="true"></span>
</li> </li>
<BreadcrumbItem :item="item" :template="$slots.item" :exact="exact" /> <BreadcrumbItem :item="item" :template="$slots.item" :exact="exact" />
@ -31,6 +31,11 @@ export default {
default: true default: true
} }
}, },
methods: {
isHomeExist(i) {
return this.home || i !== 0;
}
},
components: { components: {
BreadcrumbItem: BreadcrumbItem BreadcrumbItem: BreadcrumbItem
} }