feat: migrate Menu and Dropdown with selection and submenus

Port HeroUI menu family and Dropdown from ce90ea3: Reka DropdownMenu base,
MenuKey[] selection with section owners, 17 official demos, dropdown docs
and B01 tests. Long-press stays demo-level; submenu close is level-scoped.
This commit is contained in:
maoyingjie
2026-10-24 20:43:04 +08:00
parent 1c4ecc3def
commit 06ddb6662a
48 changed files with 3091 additions and 5 deletions
+48
View File
@@ -0,0 +1,48 @@
<script setup lang="ts">
import { ref } from "vue";
import {
DropdownRoot,
DropdownTrigger,
DropdownPopover,
DropdownMenu,
DropdownItem,
DropdownItemIndicator,
Button,
Label,
} from "@heroui-vue/components";
import type { MenuKey } from "@heroui-vue/components";
const selected = ref<MenuKey[]>(["bold"]);
</script>
<template>
<div class="flex min-w-sm flex-col items-center justify-center gap-4">
<p class="text-sm text-muted">
已选:{{ selected.length > 0 ? selected.join("、") : "无" }}
</p>
<DropdownRoot>
<DropdownTrigger>
<Button aria-label="菜单" variant="secondary">操作</Button>
</DropdownTrigger>
<DropdownPopover>
<DropdownMenu
:selected-keys="selected"
selection-mode="multiple"
@update:selected-keys="(keys: MenuKey[]) => (selected = keys)"
>
<DropdownItem id="bold" text-value="粗体">
<Label>粗体</Label>
<DropdownItemIndicator />
</DropdownItem>
<DropdownItem id="italic" text-value="斜体">
<Label>斜体</Label>
<DropdownItemIndicator />
</DropdownItem>
<DropdownItem id="underline" text-value="下划线">
<Label>下划线</Label>
<DropdownItemIndicator />
</DropdownItem>
</DropdownMenu>
</DropdownPopover>
</DropdownRoot>
</div>
</template>