Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gojs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴斌
vue-gojs
Commits
042f7692
Commit
042f7692
authored
Oct 18, 2023
by
吴斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:复制节点时,避免数组指向同一个对象
parent
8a9f9148
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
App.vue
src/App.vue
+4
-2
No files found.
src/App.vue
View file @
042f7692
...
@@ -274,6 +274,8 @@ function initDiagram(){
...
@@ -274,6 +274,8 @@ function initDiagram(){
myDiagram
.
toolManager
.
mouseMoveTools
.
insertAt
(
0
,
new
PortShiftingTool
());
myDiagram
.
toolManager
.
mouseMoveTools
.
insertAt
(
0
,
new
PortShiftingTool
());
myDiagram
.
model
.
linkFromPortIdProperty
=
"fromPort"
;
// necessary to remember portIds
myDiagram
.
model
.
linkFromPortIdProperty
=
"fromPort"
;
// necessary to remember portIds
myDiagram
.
model
.
linkToPortIdProperty
=
"toPort"
;
myDiagram
.
model
.
linkToPortIdProperty
=
"toPort"
;
myDiagram
.
model
.
copiesArrays
=
true
;
myDiagram
.
model
.
copiesArrayObjects
=
true
;
//多种类型的连接线
//多种类型的连接线
myDiagram
.
linkTemplateMap
.
add
(
''
,
ArrowLink
)
myDiagram
.
linkTemplateMap
.
add
(
''
,
ArrowLink
)
myDiagram
.
linkTemplateMap
.
add
(
'Flow'
,
FlowLink
)
myDiagram
.
linkTemplateMap
.
add
(
'Flow'
,
FlowLink
)
...
@@ -340,7 +342,7 @@ function confirmAddPort(){
...
@@ -340,7 +342,7 @@ function confirmAddPort(){
let
node
=
myDiagram
.
findNodeForData
(
selectedNode
.
value
.
data
)
as
go
.
Node
let
node
=
myDiagram
.
findNodeForData
(
selectedNode
.
value
.
data
)
as
go
.
Node
if
(
!
node
.
data
.
portArray
)
{
if
(
!
node
.
data
.
portArray
)
{
node
.
data
.
portArray
=
[]
node
.
data
.
portArray
=
[]
// node.updateTargetBindings('portArray')
// node.updateTargetBindings('portArray')
}
}
let
newPort
=
{
let
newPort
=
{
name
:
addPortForm
.
value
.
name
,
name
:
addPortForm
.
value
.
name
,
...
@@ -355,7 +357,7 @@ function confirmAddPort(){
...
@@ -355,7 +357,7 @@ function confirmAddPort(){
let
portArray
=
node
.
data
.
portArray
let
portArray
=
node
.
data
.
portArray
portArray
.
push
(
newPort
)
portArray
.
push
(
newPort
)
// myDiagram.model.insertArrayItem(portArray, -1, newPort);
// myDiagram.model.insertArrayItem(portArray, -1, newPort);
myDiagram
.
model
.
setDataProperty
(
node
.
data
,
'portArray'
,
portArray
)
myDiagram
.
model
.
setDataProperty
(
node
.
data
,
'portArray'
,
portArray
)
node
.
updateTargetBindings
(
'portArray'
)
node
.
updateTargetBindings
(
'portArray'
)
freshSelectionNode
()
freshSelectionNode
()
myDiagram
.
commitTransaction
(
"addPort"
);
myDiagram
.
commitTransaction
(
"addPort"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment