Skip to content

Commit

Permalink
不添加重复link
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjone committed May 15, 2023
1 parent 567eedd commit cb3fba2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/models/data/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ export default class AllLinks {
* 添加一条连线
*/
addLink(from: RowItem, to: RowItem) {
if (
from.uuid === to.uuid ||
this.links.some(
link => link.fromRow.uuid === from.uuid && link.toRow.uuid === to.uuid
)
) {
return;
}

const link = {
from: from.id,
to: to.id
Expand Down

0 comments on commit cb3fba2

Please sign in to comment.