feat(DropdownMenu): pass index to slots

This commit is contained in:
Benjamin Canac
2024-04-16 17:27:12 +02:00
parent b78ca9c56a
commit 735f81e771
3 changed files with 17 additions and 14 deletions

View File

@@ -41,7 +41,7 @@ export interface DropdownMenuProps<T> extends Omit<DropdownMenuRootProps, 'dir'>
export interface DropdownMenuEmits extends DropdownMenuRootEmits {}
type SlotProps<T> = (props: { item: T, active?: boolean }) => any
type SlotProps<T> = (props: { item: T, active?: boolean, index: number }) => any
export interface DropdownMenuSlots<T> {
default(): any
@@ -59,7 +59,10 @@ import { reactivePick } from '@vueuse/core'
import { UDropdownMenuContent } from '#components'
import { omit } from '#ui/utils'
const props = withDefaults(defineProps<DropdownMenuProps<T>>(), { portal: true })
const props = withDefaults(defineProps<DropdownMenuProps<T>>(), {
portal: true,
modal: false
})
const emits = defineEmits<DropdownMenuEmits>()
const slots = defineSlots<DropdownMenuSlots<T>>()