上下文菜单项
@astryxdesign/core v0.7.1 · ContextMenuItem
ContextMenuItem 属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
label | string | number | — | 行内的主要文字。需要富文本时改用 label 插槽。 |
description | string | — | 标签下方的次要说明。需要富文本时改用 description 插槽。 |
icon | string | Component | — | 标签前的图标:一个 CSS 图标类,或一个绘制 SVG 的组件。想放任意内容时改用 icon 插槽。 |
endContent | string | number | — | 跟在标签后面的纯文字。徽章这类富文本用 endContent 插槽。 |
href | string | — | 这一行要跳转的地址;给出后整行渲染成链接。 |
target | '_blank' | '_self' | — | 链接的打开方式,仅在给出 href 时使用。 |
rel | string | — | 链接关系,仅在给出 href 时使用。 |
isDisabled | boolean | false | 是否禁用这一行。禁用的行会变淡,方向键和首字母查找都会跳过它,也不能被激活。 |
hasCloseOnSelect | boolean | true | 激活这一行后是否收起菜单。 |
variant | 'default' | 'destructive' | 'default' | 这一行的视觉变体。 |
事件
| 名称 | 载荷 | 说明 |
|---|---|---|
click | MouseEvent | 激活这一行时触发,带回触发它的那次点击。 |
插槽
label:替代label属性的富文本。icon:任意前置内容,替代icon属性。description:替代description属性的富文本。endContent:标签后面的行尾内容。
这一行的角色是 role="menuitem",键盘交给上层的菜单管:方向键、Home、End 和首字母查找都在行之间移动。