Skip to content

Commit 4c9c8d3

Browse files
committed
chore(VerticalNavigation): use getULinkProps to bind links
1 parent 28b736a commit 4c9c8d3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/runtime/components/navigation/VerticalNavigation.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
22
<nav :class="ui.wrapper" v-bind="attrs">
3-
<ul v-for="(section, sectionIndex) of linkSections" :key="`linkSection${sectionIndex}`">
4-
<li v-for="(link, index) of section" :key="`linkSection${sectionIndex}-${index}`">
3+
<ul v-for="(section, sectionIndex) of sections" :key="`section${sectionIndex}`">
4+
<li v-for="(link, index) of section" :key="`section${sectionIndex}-${index}`">
55
<ULink
66
v-slot="{ isActive }"
7-
v-bind="omit(link, ['label', 'labelClass', 'icon', 'iconClass', 'avatar', 'badge', 'click'])"
7+
v-bind="getULinkProps(link)"
88
:class="[ui.base, ui.padding, ui.width, ui.ring, ui.rounded, ui.font, ui.size]"
99
:active-class="ui.active"
1010
:inactive-class="ui.inactive"
@@ -40,7 +40,7 @@
4040
</slot>
4141
</ULink>
4242
</li>
43-
<UDivider v-if="sectionIndex < linkSections.length - 1" :ui="ui.divider" />
43+
<UDivider v-if="sectionIndex < sections.length - 1" :ui="ui.divider" />
4444
</ul>
4545
</nav>
4646
</template>
@@ -54,7 +54,7 @@ import UAvatar from '../elements/Avatar.vue'
5454
import ULink from '../elements/Link.vue'
5555
import UDivider from '../layout/Divider.vue'
5656
import { useUI } from '../../composables/useUI'
57-
import { mergeConfig, omit } from '../../utils'
57+
import { mergeConfig, getULinkProps } from '../../utils'
5858
import type { VerticalNavigationLink, Strategy } from '../../types'
5959
// @ts-expect-error
6060
import appConfig from '#build/app.config'
@@ -87,16 +87,14 @@ export default defineComponent({
8787
setup (props) {
8888
const { ui, attrs } = useUI('verticalNavigation', toRef(props, 'ui'), config, toRef(props, 'class'))
8989
90-
const linkSections = computed(() => {
91-
return (Array.isArray(props.links[0]) ? props.links : [props.links]) as VerticalNavigationLink[][]
92-
})
90+
const sections = computed(() => (Array.isArray(props.links[0]) ? props.links : [props.links]) as VerticalNavigationLink[][])
9391
9492
return {
9593
// eslint-disable-next-line vue/no-dupe-keys
9694
ui,
9795
attrs,
98-
omit,
99-
linkSections,
96+
sections,
97+
getULinkProps,
10098
twMerge,
10199
twJoin
102100
}

0 commit comments

Comments
 (0)