mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-25 01:10:40 +01:00
chore(Link): add pickLinkProps util
This commit is contained in:
@@ -11,7 +11,7 @@ const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof t
|
||||
|
||||
const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) })
|
||||
|
||||
export interface BreadcrumbItem extends LinkProps {
|
||||
export interface BreadcrumbItem extends Omit<LinkProps, 'custom'> {
|
||||
label?: string
|
||||
icon?: string
|
||||
avatar?: AvatarProps
|
||||
@@ -41,7 +41,7 @@ import { computed } from 'vue'
|
||||
import { Primitive } from 'radix-vue'
|
||||
import { useAppConfig } from '#imports'
|
||||
import { ULink, UIcon, UAvatar } from '#components'
|
||||
import { omit } from '#ui/utils'
|
||||
import { pickLinkProps } from '#ui/utils/link'
|
||||
|
||||
const props = defineProps<BreadcrumbProps<T>>()
|
||||
const slots = defineSlots<BreadcrumbSlots<T>>()
|
||||
@@ -56,7 +56,7 @@ const ui = computed(() => tv({ extend: breadcrumb, slots: props.ui })())
|
||||
<ol :class="ui.list()">
|
||||
<template v-for="(item, index) in items" :key="index">
|
||||
<li :class="ui.itemWrapper()">
|
||||
<ULink as="span" v-bind="omit(item, ['label', 'icon', 'avatar', 'slot'])" :aria-current="index === items!.length - 1 ? 'page' : undefined" :class="ui.item({ active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })" raw>
|
||||
<ULink v-bind="pickLinkProps(item)" as="span" :aria-current="index === items!.length - 1 ? 'page' : undefined" :class="ui.item({ active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })" raw>
|
||||
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
||||
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="item" :active="index === items!.length - 1" :index="index">
|
||||
<UAvatar v-if="item.avatar" size="2xs" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ active: index === items!.length - 1 })" />
|
||||
|
||||
Reference in New Issue
Block a user