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:
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
DropdownRoot,
|
||||
DropdownTrigger,
|
||||
DropdownPopover,
|
||||
DropdownMenu,
|
||||
DropdownItem,
|
||||
Button,
|
||||
Label,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
function onAction(key: string | number) {
|
||||
console.log(`Selected: ${key}`);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<DropdownRoot>
|
||||
<DropdownTrigger>
|
||||
<Button aria-label="菜单" variant="secondary">操作</Button>
|
||||
</DropdownTrigger>
|
||||
<DropdownPopover>
|
||||
<DropdownMenu @action="onAction">
|
||||
<DropdownItem id="new-file" text-value="新建文件">
|
||||
<Label>新建文件</Label>
|
||||
</DropdownItem>
|
||||
<DropdownItem id="copy-link" text-value="复制链接">
|
||||
<Label>复制链接</Label>
|
||||
</DropdownItem>
|
||||
<DropdownItem id="edit-file" text-value="编辑文件">
|
||||
<Label>编辑文件</Label>
|
||||
</DropdownItem>
|
||||
<DropdownItem id="delete-file" text-value="删除文件" variant="danger">
|
||||
<Label>删除文件</Label>
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</DropdownPopover>
|
||||
</DropdownRoot>
|
||||
</template>
|
||||
Reference in New Issue
Block a user