@@ -3,13 +3,16 @@ import { ref } from 'vue'
3
3
import LogicFlow from ' @logicflow/core'
4
4
import ' @logicflow/core/dist/style/index.css'
5
5
import NodeRedExtension from ' ./node-red/index'
6
- import ' ./node-red/style.css '
6
+ import Setting from ' ./node-red/tools/Setting.vue '
7
7
8
+ import ' ./node-red/style.css'
8
9
export default {
9
10
setup () {
10
11
const count = ref (0 )
12
+ const currentNode = ref (null )
11
13
return {
12
- count
14
+ count,
15
+ currentNode
13
16
}
14
17
},
15
18
mounted () {
@@ -42,6 +45,15 @@ export default {
42
45
x: 220 ,
43
46
y: 200 ,
44
47
text: ' start'
48
+ },
49
+ {
50
+ id: ' node_123_1' ,
51
+ type: ' vue-html' ,
52
+ x: 720 ,
53
+ y: 700 ,
54
+ properties: {
55
+ t: 1
56
+ }
45
57
},
46
58
{
47
59
id: ' node_2' ,
@@ -136,18 +148,32 @@ export default {
136
148
// todo: 让流程跑起来
137
149
console .log (' 我要开始执行流程了' )
138
150
})
139
- this .lf .on (' vue-node:click' , (data ) => {
151
+ this .lf .on (' vue-node:click' , (data ) => {
140
152
this .lf .setProperties (data .id , {
141
153
t: ++ data .val
142
154
})
143
155
})
156
+ this .lf .on (' node:click' , ({ data }) => {
157
+ this .currentNode = data
158
+ })
159
+ this .lf .on (' blank:click' , ({ data }) => {
160
+ this .currentNode = null
161
+ })
162
+ },
163
+ methods: {
164
+ changeStyle (style ) {
165
+ this .lf .setProperties (this .currentNode .id , {
166
+ style
167
+ })
168
+ }
144
169
}
145
170
}
146
171
</script >
147
172
148
173
<template >
149
174
<div class =" flow-chart" >
150
175
<div ref =" container" class =" container" ></div >
176
+ <Setting v-if =" currentNode" @changeStyle =" changeStyle" :nodeData =" currentNode" class =" setting-panel" ></Setting >
151
177
</div >
152
178
</template >
153
179
@@ -164,10 +190,18 @@ export default {
164
190
.flow-chart /deep/ .lf-red-node , .flow-chart /deep/ .lf-element-text {
165
191
cursor : move ;
166
192
}
193
+ .flow-chart /deep/ svg {
194
+ display : block ;
195
+ }
167
196
.flow-chart-palette {
168
197
position : absolute ;
169
198
left : 0 ;
170
199
top : 0 ;
171
200
z-index : 1 ;
172
201
}
202
+ .setting-panel {
203
+ position : absolute ;
204
+ top : 0 ;
205
+ right : 0 ;
206
+ }
173
207
</style >
0 commit comments