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.
classNamestring""Extra classes for the underlying KunButton, merged last so yours win.
colorKunUIColor"primary"Colour of the current item. Every other item stays neutral.
currentbooleanfalseMarks 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.
disabledbooleanfalseBlocks clicks and navigation and dims the item.
hrefstring""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.
iconstring""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.
stackedbooleanfalseIcon 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.

事件

事件回调参数
clickevent: MouseEvent

插槽

插槽作用域
#icon—