Skip to content

Commit

Permalink
fix(kbreadcrumbs): make last item a link (#2098)
Browse files Browse the repository at this point in the history
  • Loading branch information
portikM authored Mar 26, 2024
1 parent 1fe7983 commit 2c290fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions sandbox/pages/SandboxBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ const breadcrumbs = [{
key: 'here',
title: 'You are here',
text: 'You are here',
to: { path: '/breadcrumbs' },
}]
</script>
10 changes: 5 additions & 5 deletions src/components/KBreadcrumbs/KBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
class="breadcrumbs-item-container"
>
<component
:is="getComponentAttrs(item, idx === items.length - 1).type"
v-bind="getComponentAttrs(item, idx === items.length - 1).attrs"
:is="getComponentAttrs(item).type"
v-bind="getComponentAttrs(item).attrs"
class="breadcrumbs-item"
:class="{ 'link': !!item.to && idx !== items.length - 1, 'active': idx === items.length - 1 }"
:class="{ 'link': !!item.to, 'active': idx === items.length - 1 }"
>
<span
v-if="$slots[`icon-${getBreadcrumbKey(item, idx)}`]"
Expand Down Expand Up @@ -65,8 +65,8 @@ defineProps({
},
})
const getComponentAttrs = (item: BreadcrumbItem, active: boolean) => {
if (!item.to || active) {
const getComponentAttrs = (item: BreadcrumbItem) => {
if (!item.to) {
return {
type: 'div',
attrs: {
Expand Down

0 comments on commit 2c290fa

Please sign in to comment.