11<template >
22 <div class =" w-full h-full" >
3- <el-button @click =" handelMiniMap" >显示小地图</el-button >
3+ <el-button @click =" handelMiniMap()" >{{ showMiniMap ? '隐藏' : '显示' }}小地图</el-button >
4+ <el-button @click =" addNode" >增加自定义节点</el-button >
45 <el-button @click =" clearFlow" >卸载画布</el-button >
56 <div ref =" container" class =" flow w-full h-full overflow-hidden" />
67 <TeleportContainer :flow-id =" flowId" />
@@ -22,6 +23,7 @@ const props = defineProps<IProps>()
2223const TeleportContainer = getTeleport ()
2324const container = ref ()
2425const graphData = ref <IGraphData >()
26+ const showMiniMap = ref (false )
2527
2628const flowId = ref (' ' )
2729
@@ -41,16 +43,16 @@ onMounted(() => {
4143 category: ' 分类123' + props .activeKey
4244 }
4345 },
44- {
45- id: ' node_id_2' ,
46- type: ' defaultNode' ,
47- x: 0 ,
48- y: 0 ,
49- properties: {
50- type: ' first' ,
51- url: ' http://www.test.com'
52- }
53- },
46+ // {
47+ // id: 'node_id_2',
48+ // type: 'defaultNode',
49+ // x: 0,
50+ // y: 0,
51+ // properties: {
52+ // type: 'first',
53+ // url: 'http://www.test.com'
54+ // }
55+ // },
5456 {
5557 id: ' node_id_3' ,
5658 type: ' analysisNode' ,
@@ -61,90 +63,90 @@ onMounted(() => {
6163 url: ' http://www.emei.vip/aaa.html' ,
6264 category: ' 分类123'
6365 }
64- },
65- {
66- id: ' node_id_4' ,
67- type: ' analysisNode' ,
68- x: 0 ,
69- y: 0 ,
70- properties: {
71- type: ' first' ,
72- url: ' http://365897.com/aaa.html' ,
73- category: ' 分类123'
74- }
75- },
76- {
77- id: ' node_id_5' ,
78- type: ' defaultNode' ,
79- x: 0 ,
80- y: 0 ,
81- properties: {
82- type: ' middle' ,
83- url: ' https://118037.com/1.html'
84- }
85- },
86- {
87- id: ' node_id_6' ,
88- type: ' defaultNode' ,
89- x: 0 ,
90- y: 0 ,
91- properties: {
92- type: ' middle' ,
93- url: ' https://www.emei.vip'
94- }
95- },
96- {
97- id: ' node_id_7' ,
98- type: ' defaultNode' ,
99- x: 0 ,
100- y: 0 ,
101- properties: {
102- type: ' middle' ,
103- url: ' https://bbbb.com'
104- }
105- },
106- {
107- id: ' node_id_8' ,
108- type: ' analysisNode' ,
109- x: 0 ,
110- y: 0 ,
111- properties: {
112- type: ' middle' ,
113- url: ' http://www.emei.vip/a.html' ,
114- category: ' 分类123'
115- }
116- },
117- {
118- id: ' node_id_9' ,
119- type: ' defaultNode' ,
120- x: 0 ,
121- y: 0 ,
122- properties: {
123- type: ' middle' ,
124- url: ' https://aaaa.com' ,
125- seq: 1
126- }
127- },
128- {
129- id: ' node_id_10' ,
130- type: ' defaultNode' ,
131- x: 0 ,
132- y: 0 ,
133- properties: {
134- type: ' landing' ,
135- url: ' https://bbbb.com'
136- }
137- },
138- {
139- id: ' node_id_11' ,
140- type: ' defaultNode' ,
141- x: 0 ,
142- y: 0 ,
143- properties: {
144- type: ' landing' ,
145- url: ' https://cccc.com'
146- }
14766 }
67+ // {
68+ // id: 'node_id_4',
69+ // type: 'analysisNode',
70+ // x: 0,
71+ // y: 0,
72+ // properties: {
73+ // type: 'first',
74+ // url: 'http://365897.com/aaa.html',
75+ // category: '分类123'
76+ // }
77+ // },
78+ // {
79+ // id: 'node_id_5',
80+ // type: 'defaultNode',
81+ // x: 0,
82+ // y: 0,
83+ // properties: {
84+ // type: 'middle',
85+ // url: 'https://118037.com/1.html'
86+ // }
87+ // },
88+ // {
89+ // id: 'node_id_6',
90+ // type: 'defaultNode',
91+ // x: 0,
92+ // y: 0,
93+ // properties: {
94+ // type: 'middle',
95+ // url: 'https://www.emei.vip'
96+ // }
97+ // },
98+ // {
99+ // id: 'node_id_7',
100+ // type: 'defaultNode',
101+ // x: 0,
102+ // y: 0,
103+ // properties: {
104+ // type: 'middle',
105+ // url: 'https://bbbb.com'
106+ // }
107+ // },
108+ // {
109+ // id: 'node_id_8',
110+ // type: 'analysisNode',
111+ // x: 0,
112+ // y: 0,
113+ // properties: {
114+ // type: 'middle',
115+ // url: 'http://www.emei.vip/a.html',
116+ // category: '分类123'
117+ // }
118+ // },
119+ // {
120+ // id: 'node_id_9',
121+ // type: 'defaultNode',
122+ // x: 0,
123+ // y: 0,
124+ // properties: {
125+ // type: 'middle',
126+ // url: 'https://aaaa.com',
127+ // seq: 1
128+ // }
129+ // },
130+ // {
131+ // id: 'node_id_10',
132+ // type: 'defaultNode',
133+ // x: 0,
134+ // y: 0,
135+ // properties: {
136+ // type: 'landing',
137+ // url: 'https://bbbb.com'
138+ // }
139+ // },
140+ // {
141+ // id: 'node_id_11',
142+ // type: 'defaultNode',
143+ // x: 0,
144+ // y: 0,
145+ // properties: {
146+ // type: 'landing',
147+ // url: 'https://cccc.com'
148+ // }
149+ // }
148150 ],
149151 edges: [
150152 {
@@ -215,8 +217,24 @@ onMounted(() => {
215217 })
216218 flowId .value = linkChart .flowId !
217219})
220+ const addNode = () => {
221+ linkChart .lf .addNode ({
222+ type: ' analysisNode' ,
223+ x: 110 ,
224+ y: 110 ,
225+ properties: {
226+ type: ' middle' ,
227+ url: ' https://bbbb.com'
228+ }
229+ })
230+ }
218231const handelMiniMap = () => {
219- linkChart .lf .extension .miniMap .show ()
232+ if (showMiniMap .value ) {
233+ linkChart .lf .extension .miniMap .hide ()
234+ } else {
235+ linkChart .lf .extension .miniMap .show ()
236+ }
237+ showMiniMap .value = ! showMiniMap .value
220238}
221239const clearFlow = () => {
222240 linkChart .destroy ()
0 commit comments