提交 9cf3d74e 编写于 作者: E ester.zhou

update ts-universal-attributes-menu.md

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 4879dc96
# Menu Control
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
This module provides APIs for binding a menu – a vertical list of items – to a component. This menu is displayed by long-pressing, clicking, or right-clicking the component.
> **NOTE**
>
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -13,28 +16,29 @@ None
| Name | Type | Default Value | Description |
| ---------------------------- | ---------------------------------------- | ------------- | ---------------------------------------- |
| bindMenu | Array<MenuItem&gt; \| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported. |
| bindContextMenu<sup>8+</sup> | content: [CustomBuilder](../../ui/ts-types.md)<br>responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. |
| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------- |
| bindMenu | Array<MenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.|
| bindContextMenu<sup>8+</sup> | content:&nbsp;[CustomBuilder](../../ui/ts-types.md),<br>responseType:&nbsp;ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. |
- MenuItem
| Name | Type | Description |
| ------ | ------------- | ---------------------------------------- |
| ------ | ----------------------- | ----------- |
| value | string | Menu item text. |
| action | () =&gt; void | Action triggered when a menu item is clicked. |
| action | ()&nbsp;=&gt;&nbsp;void | Action triggered when a menu item is clicked.|
- ResponseType<sup>8+</sup>
| Value | Description |
| ---------- | ---------------------------------------- |
| ---------- | ------------- |
| LongPress | The menu is displayed when the component is long-pressed. |
| RightClick | The menu is displayed when the component is right-clicked. |
| RightClick | The menu is displayed when the component is right-clicked.|
## Example
#### Menu with Textual Menu Items
```
```ts
// xxx.ets
@Entry
@Component
struct MenuExample {
......@@ -66,7 +70,8 @@ struct MenuExample {
#### Menu with Custom Menu Items
```
```ts
// xxx.ets
import router from '@system.router';
@Entry
......@@ -116,7 +121,8 @@ struct MenuExample {
#### Context Menu (Displayed Upon Right-Clicking)
```
```ts
// xxx.ets
@Entry
@Component
struct ContextMenuExample {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册