feat(DropdownMenu): handle item type separator

This commit is contained in:
Benjamin Canac
2024-04-25 11:48:27 +02:00
parent 7d67b4d000
commit a5bb25dd95
4 changed files with 5 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type'> {
* The item type.
* @defaultValue "link"
*/
type?: 'label' | 'link'
type?: 'label' | 'separator' | 'link'
slot?: string
open?: boolean
defaultOpen?: boolean

View File

@@ -73,6 +73,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
<DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label()">
<ReuseItemTemplate :item="item" :index="index" />
</DropdownMenu.Label>
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="ui.separator()" />
<DropdownMenu.Sub v-else-if="item?.children?.length">
<DropdownMenu.SubTrigger
as="button"