Skip to content

Commit

Permalink
fix: 修复添加节点时的id问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JessYan0913 committed Aug 19, 2023
1 parent d543094 commit e5838ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export class App extends BaseService<EventArgs> {
public _add(...nodes: KonvaNode[]): void {
this.mainLayer.add(
...nodes.map((node) => {
node.id(`#${guid()}`);
if (!node.attrs.id) {
node.id(`#${guid()}`);
}
return node;
})
);
Expand Down

0 comments on commit e5838ed

Please sign in to comment.