Skip to content

Commit 4b653ef

Browse files
committedDec 5, 2024
feat(NavigationMenu): handle item.trailingIcon display
1 parent 816bb69 commit 4b653ef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎playground/app/pages/components/navigation-menu.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ const items = [
5252
label: 'NavigationMenu',
5353
icon: 'i-lucide-file',
5454
description: 'Display a list of links.',
55-
to: '/components/navigation-menu'
55+
to: '/components/navigation-menu',
56+
trailingIcon: 'i-lucide-check'
5657
}, {
5758
label: 'Pagination',
5859
icon: 'i-lucide-file',

‎src/runtime/components/NavigationMenu.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
187187
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
188188
</span>
189189

190-
<span v-if="item.badge || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
190+
<span v-if="item.badge || (orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length) || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
191191
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="(item as T)" :active="active" :index="index">
192192
<UBadge
193193
v-if="item.badge"
@@ -199,6 +199,7 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
199199
/>
200200

201201
<UIcon v-if="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length)" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
202+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
202203
</slot>
203204
</span>
204205
</slot>

0 commit comments

Comments
 (0)
Please sign in to comment.