diff --git a/src/views/monitor/topology-build/hooks/useGraph.ts b/src/views/monitor/topology-build/hooks/useGraph.ts index d8d897b7..c54bf84f 100644 --- a/src/views/monitor/topology-build/hooks/useGraph.ts +++ b/src/views/monitor/topology-build/hooks/useGraph.ts @@ -51,6 +51,9 @@ export default function useGraph() { offseY: 10, itemTypes: ['canvas'], getContent(evt) { + console.log(evt); + if (!evt) return '无'; + const edit = graphMode.value === 'edit'; return `
- 1. 显示所有隐藏项 + 显示所有隐藏项
-
- 2. 新增边 +
+ 新增边
-
- 3. 新增节点 -
-
- 4. 新增分组 +
+ 新增节点
+
+ 新增分组 +
`; }, handleMenuClick(target, item) { @@ -164,6 +173,9 @@ export default function useGraph() { itemTypes: ['node'], getContent(evt) { console.log(evt); + if (!evt) return '无'; + const item = evt.item?.getModel(); + const edit = graphMode.value === 'edit'; return `
-

节点

-
- 1. 编辑 -
-
- 2. 删除 -
+

节点:${item?.label || '无标签'}

- 3. 隐藏 + 隐藏
+
+ 编辑 +
+
+ 删除 +
+
`; }, @@ -238,6 +255,9 @@ export default function useGraph() { itemTypes: ['edge'], getContent(evt) { console.log(evt); + if (!evt) return '无'; + const item = evt.item?.getModel(); + const edit = graphMode.value === 'edit'; return `
-

-
- 1. 编辑 -
-
- 2. 删除 -
+ 边:${item?.label || '无标签'}
- 3. 隐藏 + 隐藏
+
+ 编辑 +
+
+ 删除 +
`; }, @@ -288,7 +312,6 @@ export default function useGraph() { if (!item?.label) { return '无标签'; } - console.log(item); return `