2023-08-30 19:46:37 +08:00
|
|
|
|
---
|
|
|
|
|
title: MenuConfig
|
|
|
|
|
---
|
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[概述 - v5.0.0-alpha.9](../../README.zh.md) / [模块](../../modules.zh.md) / [插件](../../modules/plugins.zh.md) / MenuConfig
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[插件](../../modules/plugins.zh.md).MenuConfig
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
`MenuConfig` 接口包含以下属性:
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
- `handleMenuClick`:用于处理菜单点击事件的可选函数。它接受两个参数:`target`(类型为 HTMLElement)和 `item`(类型为 Item),并且没有返回值。
|
|
|
|
|
- `getContent`:用于获取菜单内容的可选函数。它接受一个可选的 `IG6GraphEvent` 类型参数,并返回 HTMLDivElement、string 或 Promise(解析为 HTMLDivElement 或 string)类型的值。
|
|
|
|
|
- `offsetX`:表示菜单在 X 方向上的偏移量的可选数字。
|
|
|
|
|
- `offsetY`:表示菜单在 Y 方向上的偏移量的可选数字。
|
|
|
|
|
- `shouldBegin`:用于确定是否应显示菜单的可选函数。它接受一个可选的 `IG6GraphEvent` 类型参数,并返回布尔值。
|
|
|
|
|
- `itemTypes`:表示允许显示菜单的项目类型的可选字符串数组。
|
|
|
|
|
- `trigger`:一个可选字符串,为 'click' 或 'contextmenu',表示触发菜单显示的事件类型。
|
|
|
|
|
- `onHide`:当菜单隐藏时执行的可选函数。它不接受任何参数并返回布尔值。
|
|
|
|
|
- `loadingContent`:表示加载 DOM 的可选 HTMLDivElement 或字符串。
|
|
|
|
|
- `liHoverStyle`:表示鼠标悬停在 li 元素上时的样式的可选对象。它可以包含任意数量的键值对,其中键是样式名称,值是字符串。
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
## 层次结构
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
- `IPluginBaseConfig`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
↳ **`MenuConfig`**
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
## 属性
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### className
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **className**: `string`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 继承自
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
IPluginBaseConfig.className
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/types/plugin.ts:6](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/types/plugin.ts#L6)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### container
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **container**: `string` \| `HTMLDivElement`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 继承自
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
IPluginBaseConfig.container
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/types/plugin.ts:5](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/types/plugin.ts#L5)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### getContent
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **getContent**: (`evt?`: [`IG6GraphEvent`](../behaviors/IG6GraphEvent.zh.md)) => `string` \| `HTMLDivElement` \| `Promise`<`string` \| `HTMLDivElement`\>
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 类型声明
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
▸ (`evt?`): `string` \| `HTMLDivElement` \| `Promise`<`string` \| `HTMLDivElement`\>
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 参数
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
| 名称 | 类型 |
|
|
|
|
|
| :----- | :-------------------------------------------------- |
|
|
|
|
|
| `evt?` | [`IG6GraphEvent`](../behaviors/IG6GraphEvent.zh.md) |
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 返回
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
帮您翻译
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 参数
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
| 名称 | 类型 |
|
|
|
|
|
| :----- | :-------------------------------------------------- |
|
|
|
|
|
| `evt?` | [`IG6GraphEvent`](../behaviors/IG6GraphEvent.zh.md) |
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 返回
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
`string` \| `HTMLDivElement` \| `Promise`<`string` \| `HTMLDivElement`\>
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:54](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L54)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### graph
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **graph**: [`IGraph`](../graph/IGraph.zh.md)<`BehaviorRegistry`, `ThemeRegistry`\>
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 继承自
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
IPluginBaseConfig.graph
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/types/plugin.ts:7](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/types/plugin.ts#L7)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### handleMenuClick
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **handleMenuClick**: (`target`: `HTMLElement`, `item`: `default`) => `void`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 类型声明
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
▸ (`target`, `item`): `void`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 参数
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
| 名称 | 类型 |
|
|
|
|
|
| :------- | :------------ |
|
|
|
|
|
| `target` | `HTMLElement` |
|
|
|
|
|
| `item` | `default` |
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 返回
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
`void`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:52](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L52)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### itemTypes
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **itemTypes**: `string`[]
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:60](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L60)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### liHoverStyle
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **liHoverStyle**: `Object`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 索引签名
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
▪ [key: `string`]: `string`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:65](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L65)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### loadingContent
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **loadingContent**: `string` \| `HTMLDivElement`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:64](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L64)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### offsetX
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **offsetX**: `number`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:57](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L57)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### offsetY
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **offsetY**: `number`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:58](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L58)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### onHide
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **onHide**: () => `boolean`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 类型声明
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
▸ (): `boolean`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 返回
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
`boolean`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 定义在
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
[packages/g6/src/stdlib/plugin/menu/index.ts:62](https://github.com/antvis/G6/blob/a69acd5592/packages/g6/src/stdlib/plugin/menu/index.ts#L62)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
### shouldBegin
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
• `Optional` **shouldBegin**: (`evt?`: [`IG6GraphEvent`](../behaviors/IG6GraphEvent.zh.md)) => `boolean`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
#### 类型声明
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
▸ (`evt?`): `boolean`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
2023-08-31 01:43:08 +08:00
|
|
|
|
##### 参数
|