Skip to content

Commit d94aacd

Browse files
committed
refactor(CNavItem): imrove syntax
1 parent 0bc9c7f commit d94aacd

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/components/nav/CNavItem.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,26 @@ const CNavItem = defineComponent({
88
...CNavLink.props,
99
},
1010
setup(props, { slots }) {
11-
const children = () =>
12-
props.href
13-
? h(
14-
CNavLink,
15-
{
16-
active: props.active,
17-
component: props.component,
18-
disabled: props.disabled,
19-
href: props.href,
20-
to: props.to,
21-
},
22-
slots.default && slots.default(),
23-
)
24-
: slots.default && slots.default()
2511
return () =>
2612
h(
2713
'li',
2814
{
2915
class: 'nav-item',
3016
},
31-
children(),
17+
props.href
18+
? h(
19+
CNavLink,
20+
{
21+
active: props.active,
22+
component: props.component,
23+
disabled: props.disabled,
24+
href: props.href,
25+
},
26+
{
27+
default: () => slots.default && slots.default(),
28+
},
29+
)
30+
: slots.default && slots.default(),
3231
)
3332
},
3433
})

0 commit comments

Comments
 (0)