NavItem (导航项)
应用外壳里的一个导航目的地:一个铺满宽度的 KunButton,当前页为 flat 并带 aria-current="page";stacked 时图标在上、文字在下,用于侧轨或底栏。
KunNavItem 只是导航里的一项,不包含容器:侧轨、侧边栏还是底栏,由应用自己排布。 它不读取路由,哪一项是当前页由应用通过 current 决定。
侧轨(stacked)
Rail.vue
侧边栏
Sidebar.vue
带徽标的图标
Badge.vue
属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| label * | string | — | The destination's name, shown under or beside the icon. |
| className | string | "" | Extra classes for the underlying KunButton, merged last so yours win. |
| color | KunUIColor | "primary" | Colour of the current item. Every other item stays neutral. |
| current | boolean | false | Marks the page the user is on: the item turns `flat` in `color`, and says so to assistive technology with `aria-current="page"`. KunUI does not read the route; the app decides which item is current. |
| disabled | boolean | false | Blocks clicks and navigation and dims the item. |
| href | string | "" | Where the item goes. It renders as a link, through the configured link component; without it the item is a button and `click` is the action. |
| icon | string | "" | Iconify name of the icon, e.g. `lucide:compass`. The `#icon` slot replaces it — wrap the icon in a `KunBadge` there to show an unread count on it. |
| stacked | boolean | false | Icon over label, as a rail or a bottom bar draws a destination. Off, the icon sits beside the label, as a sidebar row draws it. |
事件
| 事件 | 回调参数 |
|---|---|
| click | event: MouseEvent |
插槽
| 插槽 | 作用域 |
|---|---|
| #icon | — |