Components

DropdownMenu 下拉菜单

操作菜单:图标、快捷键提示、分隔线与破坏性项,全键盘可达。

实例操作

items 数组声明式定义,separator 项仅渲染分隔线。

<DropdownMenu :items="[
  { label: '查看拓扑分析', onSelect: () => toast({ title: '导航至拓扑分析视图' }) },
  { label: '复制连接字符串', onSelect: () => toast({ title: '已复制凭证至剪贴板', variant: 'success' }) },
  { separator: true },
  { label: '删除该实例', destructive: true, onSelect: () => toast({ title: '实例已终止', variant: 'destructive' }) }
]">
  <template #trigger>
    <Button variant="outline" color="neutral">选项菜单</Button>
  </template>
</DropdownMenu>

API 参考

属性类型默认值说明
items{ label, icon?, disabled?, destructive?, separator?, onSelect? }[]—菜单项。
side-offsetnumber4浮层偏移。
triggerslot—触发元素。