From 03edad885d082a38688e0d34efe12c3f86fc0291 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 20 Mar 2024 14:08:40 +0100 Subject: [PATCH] fix(NavigationMenu): prevent err without links --- src/runtime/components/NavigationMenu.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/runtime/components/NavigationMenu.vue b/src/runtime/components/NavigationMenu.vue index 7c7c68a9..4e5363bf 100644 --- a/src/runtime/components/NavigationMenu.vue +++ b/src/runtime/components/NavigationMenu.vue @@ -45,7 +45,6 @@ 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 { omit } from '../utils' const props = withDefaults(defineProps>(), { orientation: 'horizontal' }) const emits = defineEmits() @@ -57,7 +56,7 @@ const ui = computed(() => tv({ extend: navigationMenu, slots: props.ui })({ orientation: props.orientation })) -const lists = computed(() => (Array.isArray(props.links[0]) ? props.links : [props.links]) as T[][]) +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) {