diff --git a/playground/pages/navigation-menu.vue b/playground/pages/navigation-menu.vue index 746245c7..2215bc00 100644 --- a/playground/pages/navigation-menu.vue +++ b/playground/pages/navigation-menu.vue @@ -2,11 +2,11 @@ const links = [ [{ label: 'Profile', + active: true, avatar: { src: 'https://avatars.githubusercontent.com/u/739984?v=4' }, badge: 100, - coucou: 'test', click () { console.log('Profile clicked') } diff --git a/src/runtime/components/NavigationMenu.vue b/src/runtime/components/NavigationMenu.vue index c38fc2aa..8a9e8795 100644 --- a/src/runtime/components/NavigationMenu.vue +++ b/src/runtime/components/NavigationMenu.vue @@ -4,7 +4,7 @@ import type { NavigationMenuRootProps, NavigationMenuRootEmits } from 'radix-vue import type { AppConfig } from '@nuxt/schema' import _appConfig from '#build/app.config' import theme from '#build/ui/navigationMenu' -import { getNuxtLinkProps, type LinkProps } from '#ui/components/Link.vue' +import type { LinkProps } from '#ui/components/Link.vue' import type { AvatarProps } from '#ui/components/Avatar.vue' import type { BadgeProps } from '#ui/components/Badge.vue' @@ -16,8 +16,6 @@ export interface NavigationMenuLink extends LinkProps { label: string | number icon?: string avatar?: AvatarProps - click?: Function - class?: any badge?: string | number | BadgeProps } @@ -42,7 +40,8 @@ export interface NavigationMenuSlots { import { computed } from 'vue' import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuLink, useForwardPropsEmits } from 'radix-vue' import { reactivePick } from '@vueuse/core' -import { NuxtLink, UIcon, UAvatar, UBadge } from '#components' +import { UIcon, UAvatar, UBadge, ULink, ULinkBase } from '#components' +import { omit } from '#ui/utils' const props = withDefaults(defineProps>(), { orientation: 'horizontal' }) const emits = defineEmits() @@ -50,49 +49,30 @@ defineSlots>() const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'delayDuration', 'skipDelayDuration', 'orientation'), emits) -const ui = computed(() => tv({ extend: navigationMenu, slots: props.ui })({ - orientation: props.orientation -})) +const ui = computed(() => tv({ extend: navigationMenu, slots: props.ui })({ orientation: props.orientation })) const lists = computed(() => props.links?.length ? (Array.isArray(props.links[0]) ? props.links : [props.links]) as T[][] : []) - -function onClick (e: MouseEvent, link: NavigationMenuLink, { href, navigate, isExternal }: { href: string; navigate: Function; isExternal: boolean }) { - if (link.click) { - link.click(e) - } - - if (href && !isExternal) { - navigate(e) - } -}