Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 342ba88

Browse filesBrowse files
committed
refactor(CNavItem): pass anchor attributes to the internal element if the href attribute is set
1 parent 741c27b commit 342ba88
Copy full SHA for 342ba88

File tree

1 file changed

+9
-2
lines changed
Filter options

1 file changed

+9
-2
lines changed

‎packages/coreui-vue/src/components/nav/CNavItem.ts

Copy file name to clipboardExpand all lines: packages/coreui-vue/src/components/nav/CNavItem.ts
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import type { ComponentProps } from '../../utils/ComponentProps'
55

66
interface CNavItemProps extends ComponentProps<typeof CNavLink> {
77
as: string
8+
class: string
89
}
910

1011
const CNavItem = defineComponent({
1112
name: 'CNavItem',
13+
inheritAttrs: false,
1214
props: {
1315
/**
1416
* Toggle the active state for the component.
@@ -21,6 +23,10 @@ const CNavItem = defineComponent({
2123
type: String,
2224
default: 'li',
2325
},
26+
/**
27+
* A string of all className you want applied to the component.
28+
*/
29+
class: String,
2430
/**
2531
* Toggle the disabled state for the component.
2632
*/
@@ -30,17 +36,18 @@ const CNavItem = defineComponent({
3036
*/
3137
href: String,
3238
},
33-
setup(props: CNavItemProps, { slots }) {
39+
setup(props: CNavItemProps, { attrs, slots }) {
3440
return () =>
3541
h(
3642
props.as,
3743
{
38-
class: 'nav-item',
44+
class: ['nav-item', props.class],
3945
},
4046
props.href
4147
? h(
4248
CNavLink,
4349
{
50+
...attrs,
4451
active: props.active,
4552
disabled: props.disabled,
4653
href: props.href,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.