|
@@ -271,7 +271,14 @@ const methods = {
|
|
deleteNode (node) {
|
|
deleteNode (node) {
|
|
this.data.nodeList.some((v, index) => {
|
|
this.data.nodeList.some((v, index) => {
|
|
if (v.id === node.id) {
|
|
if (v.id === node.id) {
|
|
|
|
+ // 删除节点
|
|
this.data.nodeList.splice(index, 1)
|
|
this.data.nodeList.splice(index, 1)
|
|
|
|
+ // 删除节点的连线
|
|
|
|
+ this.data.lineList.forEach((item, lineIndex) => {
|
|
|
|
+ if (item.from === node.id || item.to === node.id) {
|
|
|
|
+ this.data.lineList.splice(index, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
this.jsPlumb.remove(v.id)
|
|
this.jsPlumb.remove(v.id)
|
|
return true
|
|
return true
|
|
} else {
|
|
} else {
|