06ddb6662a
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.
39 lines
1.0 KiB
Vue
39 lines
1.0 KiB
Vue
<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>
|