0.1.28 • Published 5 years ago

rat-menu v0.1.28

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
5 years ago

rat-menu

组件介绍

  • category: Components
  • chinese: 菜单
  • type: 展示

API

Menu

参数说明类型默认值
children菜单项和子菜单ReactNode-
onItemClick点击菜单项触发的回调函数签名:Function(key: String, item: Object, event: Object) => void参数:key: {String} 点击的菜单项的 key 值item: {Object} 点击的菜单项对象event: {Object} 点击的事件对象Function() => {}
openKeys当前打开的子菜单的 key 值String/Array-
defaultOpenKeys初始打开的子菜单的 key 值String/Array[]
defaultOpenAll初始展开所有的子菜单,只在 mode 设置为 'inline' 以及 openMode 设置为 'multiple' 下生效,优先级高于 defaultOpenKeysBooleanfalse
onOpen打开或关闭子菜单触发的回调函数签名:Function(key: String, extra: Object) => void参数:key: {String} 打开的所有子菜单的 key 值extra: {Object} 额外参数extra.key: {String} 当前操作子菜单的 key 值extra.open: {Boolean} 是否是打开Function() => {}
mode子菜单打开的模式可选值:'inline', 'popup'Enum'inline'
triggerType子菜单打开的触发行为可选值:'click', 'hover'Enum'click'
openMode展开内连子菜单的模式,同时可以展开一个子菜单还是多个子菜单,该属性仅在 mode 为 inline 时生效可选值:'single', 'multiple'Enum'multiple'
inlineIndent内连子菜单缩进距离Number20
popupAutoWidth是否自动让弹层的宽度和菜单项保持一致,如果弹层的宽度比菜单项小则和菜单项保持一致,如果宽度大于菜单项则不做处理Booleanfalse
popupAlign弹层的对齐方式可选值:'follow', 'outside'Enum'follow'
popupProps弹层自定义 propsObject/Function{}
popupClassName弹出子菜单自定义 classNameString-
popupStyle弹出子菜单自定义 styleObject-
selectedKeys当前选中菜单项的 key 值String/Array-
defaultSelectedKeys初始选中菜单项的 key 值String/Array[]
onSelect选中或取消选中菜单项触发的回调函数签名:Function(selectedKeys: Array, item: Object, extra: Object) => void参数:selectedKeys: {Array} 选中的所有菜单项的值item: {Object} 选中或取消选中的菜单项extra: {Object} 额外参数extra.select: {Boolean} 是否是选中extra.key: {Array} 菜单项的 keyextra.label: {Object} 菜单项的文本extra.keyPath: {Array} 菜单项 key 的路径Function() => {}
selectMode选中模式,单选还是多选,默认无值,不可选可选值:'single', 'multiple'Enum-
shallowSelect是否只能选择第一层菜单项(不能选择子菜单中的菜单项)Booleanfalse
hasSelectedIcon是否显示选中图标,如果设置为 false 需配合配置平台设置选中时的背景色以示区分Booleantrue
direction菜单第一层展示方向可选值:'ver', 'hoz'Enum'ver'
hozAlign横向菜单条 item 和 footer 的对齐方向,在 direction 设置为 'hoz' 并且 header 存在时生效可选值:'left', 'right'Enum'left'
header自定义菜单头部ReactNode-
footer自定义菜单尾部ReactNode-
autoFocus是否自动获得焦点Booleanfalse
focusedKey当前获得焦点的子菜单或菜单项 key 值String-

Menu.Item

参数说明类型默认值
disabled是否禁用Booleanfalse
helper帮助文本ReactNode-
children菜单项标签内容ReactNode-

Menu.SubMenu

参数说明类型默认值
label标签内容ReactNode-
selectable是否可选,该属性仅在设置 Menu 组件 selectMode 属性后生效Booleanfalse
mode子菜单打开方式,如果设置会覆盖 Menu 上的同名属性可选值:'inline', 'popup'EnumMenu 的 mode 属性值
children菜单项或下一级子菜单ReactNode-

Menu.PopupItem

参数说明类型默认值
label标签内容ReactNode-
children自定义弹层内容ReactNode-

Menu.Group

参数说明类型默认值
label标签内容ReactNode-
children菜单项ReactNode-

Menu.Divider

ARIA and KeyBoard

按键说明
Up Arrow导航到上一项
Down Arrow导航到下一项
Right Arrow打开子菜单,导航到子菜单第一项;横向菜单条第一层,导航到右一项
Left Arrow关闭子菜单,导航到父级菜单;横向菜单条第一层,导航都左一项
Enter打开子菜单,导航到子菜单第一项
Esc关闭子菜单,导航到父级菜单
SPACE切换选中状态
0.1.28

5 years ago

0.1.27

6 years ago

0.1.26

6 years ago

0.1.25

6 years ago

0.1.24

6 years ago

0.1.23

7 years ago

0.1.22

7 years ago

0.1.21

7 years ago

0.1.20

7 years ago

0.1.19

7 years ago

0.1.18

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago