From 8f968839fa8ce0c7588ba1e06d5aa6d25f28a2ae Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 29 Dec 2023 18:43:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=93=E6=89=91=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A8=A1=E5=BC=8F=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/topology-build/hooks/useGraph.ts | 73 ++++++++++++------- 1 file changed, 48 insertions(+), 25 deletions(-) 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 `