Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit342ba88

Browse files
committed
refactor(CNavItem): pass anchor attributes to the internal element if the href attribute is set
1 parent741c27b commit342ba88

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines 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
interfaceCNavItemPropsextendsComponentProps<typeofCNavLink>{
77
as:string
8+
class:string
89
}
910

1011
constCNavItem=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)

[8]ページ先頭

©2009-2025 Movatter.jp