Menuquan

Menu

阅读时间约 3 分钟

菜单组件。一般在 MenubarContextMenuDropdown 组件中使用。

import { Menu } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/menu/style/index.css'

const MenuItem = Menu.Item
const SubMenu = Menu.SubMenu
const Divider = Menu.Divider

<Menu hasIcon={true} onClick={this.onMenuClick}>
  <MenuItem onClick={this.onMenuItemClick} name="undo" icon={<UndoOutlined />} hotkey="Cmd+Z" text="Undo" />
  <MenuItem name="redo" icon={<RedoOutlined />} tkey="Cmd+Shift+Z" text="Redo" />
  <Divider />
  <MenuItem name="cut" icon={<ScissorOutlined />} hotkey="Cmd+X" t="Cut" />
  <MenuItem name="copy" icon={<CopyOutlined />} hotkey="Cmd+C" text="Copy" />
  <MenuItem name="paste" icon={<SnippetsOutlined />} hotkey="Cmd+V" disabled={true} text="Paste" />
  <MenuItem name="delete" icon={<DeleteOutlined />} hotkey="Delete" text="Delete" />
  <Divider />
  <SubMenu text="Appearance" icon={<ControlOutlined />}>
    <MenuItem name="zen" icon={<DesktopOutlined />} hotkey="Cmd+K Z" text="Zen Mode" />
    <MenuItem name="fullscreen" icon={<FullscreenOutlined />} hotkey="Cmd+Shift+F" text="Full Screen" />
    <Divider />
    <MenuItem name="side-bar" text="Show Side Bar" />
    <MenuItem name="status-bar" text="Show Status Bar" />
    <MenuItem name="activity-bar" text="Show Activity Bar" />
    <MenuItem name="editor-area" text="Show Editor Area" />
    <MenuItem name="show-panel" text="Show Panel" />
  </SubMenu>
</Menu>
参数说明类型默认值
className自定义的样式名string-
hasIcon是否包含 Iconbooleanfalse
onClick点击 MenuItem 调用此函数(name: string) => void-
registerHotkey注册快捷键(hotkey: string, handler: () => void) => void-
unregisterHotkey取消注册快捷键(hotkey: string, handler: () => void) => void-
参数说明类型默认值
className自定义的样式名string-
name菜单名称(唯一标识),在 Menu 的 onClick 回调中使用,如果不设置 name 属性,onClick 将不会被调用。string-
icon菜单图标ReactNode-
text菜单文本string-
hotkey菜单快捷键string-
active是否被激活(显示鼠标 Hover 的背景)booleanfalse
hidden是否隐藏booleanfalse
disabled是否被禁用booleanfalse
onClick点击 MenuItem 调用此函数() => void-
children额外的子组件ReactNode-
参数说明类型默认值
className自定义的样式名string-
name菜单名称(唯一标识),在 Menu 的 onClick 回调用使用string-
icon菜单图标ReactNode-
text菜单文本string-
hotkey菜单快捷键string-
active是否被激活(显示鼠标 Hover 的背景和子菜单)booleanfalse
hidden是否隐藏booleanfalse
disabled是否被禁用booleanfalse
onClick点击 MenuItem 调用此函数() => void-

菜单项分割线。

import { ColorPicker } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/color-picker/style/index.css'

<div style={{ width: 120 }}>
  <ColorPicker color="#333333" />
</div>

import { ColorPicker } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/color-picker/style/index.css'

<div style={{ width: 120 }}>
  <ColorPicker color="#333333" />
</div>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值