未验证 提交 852b28c2 编写于 作者: X xrk 提交者: GitHub

docs: update menu api (#27096)

* docs: update menu api

* perf
上级 b64d02fd
......@@ -11,7 +11,7 @@ title:
## en-US
Show the dynamic switching mode (between 'inline' and 'vertical').
Show the dynamic switching mode (between `inline` and `vertical`).
```jsx
import { Menu, Switch, Divider } from 'antd';
......
......@@ -7,11 +7,11 @@ title:
## zh-CN
内建了两套主题 `light|dark`,默认 `light`
内建了两套主题 `light``dark`,默认 `light`
## en-US
There are two built-in themes: 'light' and 'dark'. The default value is 'light'.
There are two built-in themes: `light` and `dark`. The default value is `light`.
```jsx
import { Menu, Switch } from 'antd';
......
......@@ -34,21 +34,21 @@ More layouts with navigation: [Layout](/components/layout).
| forceSubMenuRender | Render submenu into DOM before it becomes visible | boolean | false | |
| inlineCollapsed | Specifies the collapsed status when menu is inline mode | boolean | - | |
| inlineIndent | Indent (in pixels) of inline menu items on each level | number | 24 | |
| mode | Type of menu; `vertical`, `horizontal`, or `inline` | `vertical` \| `horizontal` \| `inline` | `vertical` | |
| mode | Type of menu | `vertical` \| `horizontal` \| `inline` | `vertical` | |
| multiple | Allows selection of multiple items | boolean | false | |
| onClick | Called when a menu item is clicked | function({ item, key, keyPath, domEvent }) | - | |
| onDeselect | Called when a menu item is deselected (multiple mode only) | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| onOpenChange | Called when sub-menus are opened or closed | function(openKeys: string\[]) | - | |
| onSelect | Called when a menu item is selected | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| openKeys | Array with the keys of currently opened sub-menus | string\[] | - | |
| overflowedIndicator | Customized icon when menu is collapsed | ReactNode | - | |
| selectable | Allows selecting menu items | boolean | true | |
| selectedKeys | Array with the keys of currently selected menu items | string\[] | - | |
| style | Style of the root node | CSSProperties | - | |
| subMenuCloseDelay | Delay time to hide submenu when mouse leaves (in seconds) | number | 0.1 | |
| subMenuOpenDelay | Delay time to show submenu when mouse enters, (in seconds) | number | 0 | |
| theme | Color theme of the menu | `light` \| `dark` | `light` | |
| onClick | Called when a menu item is clicked | function({ item, key, keyPath, domEvent }) | - | |
| onDeselect | Called when a menu item is deselected (multiple mode only) | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| triggerSubMenuAction | Which action can trigger submenu open/close | `hover` \| `click` | `hover` | |
| onOpenChange | Called when sub-menus are opened or closed | function(openKeys: string\[]) | - | |
| onSelect | Called when a menu item is selected | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| overflowedIndicator | Customized icon when menu is collapsed | ReactNode | - | |
> More options in [rc-menu](https://github.com/react-component/menu#api)
......@@ -56,11 +56,11 @@ More layouts with navigation: [Layout](/components/layout).
| Param | Description | Type | Default value | Version |
| -------- | ------------------------------------ | --------- | ------------- | ------- |
| danger | Display the danger style | boolean | false | 4.3.0 |
| disabled | Whether menu item is disabled | boolean | false | |
| icon | The icon of the menu item | ReactNode | - | 4.2.0 |
| key | Unique ID of the menu item | string | - | |
| title | Set display title for collapsed item | string | - | |
| icon | The icon of the menu item | ReactNode | - | 4.2.0 |
| danger | Display the danger style | boolean | false | 4.3.0 |
> Note: `icon` is a newly added prop in`4.2.0`. For previous versions, please use the following method to define the icon.
>
......@@ -85,13 +85,14 @@ More layouts with navigation: [Layout](/components/layout).
| Param | Description | Type | Default value | Version |
| --- | --- | --- | --- | --- |
| popupClassName | Sub-menu class name | string | - | |
| children | Sub-menus or sub-menu items | Array<MenuItem \| SubMenu> | - | |
| disabled | Whether sub-menu is disabled | boolean | false | |
| key | Unique ID of the sub-menu | string | - | |
| title | Title of sub menu | ReactNode | - | |
| icon | Icon of sub menu | ReactNode | - | 4.2.0 |
| key | Unique ID of the sub-menu | string | - | |
| onTitleClick | Callback executed when the sub-menu title is clicked | function({ key, domEvent }) | - | |
| popupClassName | Sub-menu class name | string | - | |
| popupOffset | Sub-menu offset | \[number, number] | - | |
| title | Title of sub menu | ReactNode | - | |
### Menu.ItemGroup
......
......@@ -37,31 +37,31 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
| inlineIndent | inline 模式的菜单缩进宽度 | number | 24 | |
| mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | `vertical` \| `horizontal` \| `inline` | `vertical` | |
| multiple | 是否允许多选 | boolean | false | |
| onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath, domEvent }) | - | |
| onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string\[]) | - | |
| onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | -   | |
| openKeys | 当前展开的 SubMenu 菜单项 key 数组 | string\[] | - | |
| overflowedIndicator | 自定义 Menu 折叠时的图标 | ReactNode | - | |
| selectable | 是否允许选中 | boolean | true | |
| selectedKeys | 当前选中的菜单项 key 数组 | string\[] | - | |
| style | 根节点样式 | CSSProperties | - | |
| subMenuCloseDelay | 用户鼠标离开子菜单后关闭延时,单位:秒 | number | 0.1 | |
| subMenuOpenDelay | 用户鼠标进入子菜单后开启延时,单位:秒 | number | 0 | |
| theme | 主题颜色 | `light` \| `dark` | `light` | |
| onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath, domEvent }) | - | |
| onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
| triggerSubMenuAction | SubMenu 展开/关闭的触发行为 | `hover` \| `click` | `hover` | |
| onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string\[]) | - | |
| onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | -   | |
| overflowedIndicator | 自定义 Menu 折叠时的图标 | ReactNode | - | |
> More options in [rc-menu](https://github.com/react-component/menu#api)
> 更多属性查看 [rc-menu](https://github.com/react-component/menu#api)
### Menu.Item
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------- | ------------------------ | --------- | ------ | ----- |
| danger | 展示错误状态样式 | boolean | false | 4.3.0 |
| disabled | 是否禁用 | boolean | false | |
| icon | 菜单图标 | ReactNode | - | 4.2.0 |
| key | item 的唯一标志 | string | - | |
| title | 设置收缩时展示的悬浮标题 | string | - | |
| icon | 菜单图标 | ReactNode | - | 4.2.0 |
| danger | 展示错误状态样式 | boolean | false | 4.3.0 |
> 注意:`icon` 是 `4.2.0` 新增的属性,之前的版本请使用下面的方式定义图标。
>
......@@ -86,13 +86,14 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------------- | -------------- | ----------------------------- | ------ | ----- |
| popupClassName | 子菜单样式 | string | - | |
| children | 子菜单的菜单项 | Array<MenuItem \| SubMenu> | - | |
| disabled | 是否禁用 | boolean | false | |
| key | 唯一标志 | string | - | |
| title | 子菜单项值 | ReactNode | - | |
| icon | 菜单图标 | ReactNode | - | 4.2.0 |
| key | 唯一标志 | string | - | |
| onTitleClick | 点击子菜单标题 | function({ key, domEvent }) | - | |
| popupClassName | 子菜单样式 | string | - | |
| popupOffset | 子菜单偏移量 | \[number, number] | - | |
| title | 子菜单项值 | ReactNode | - | |
### Menu.ItemGroup
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册