mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
fix: nextId() 逻辑调整
This commit is contained in:
parent
ffaa15fc6b
commit
488a5d8283
@ -148,7 +148,12 @@ export class DocumentModel {
|
||||
* 生成唯一id
|
||||
*/
|
||||
nextId() {
|
||||
return (this.id.slice(-10) + (++this.seqId).toString(36)).toLocaleLowerCase();
|
||||
let id;
|
||||
do {
|
||||
id = 'node_' + (this.id.slice(-10) + (++this.seqId).toString(36)).toLocaleLowerCase();
|
||||
} while (this.nodesMap.get(id))
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -148,7 +148,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
|
||||
constructor(readonly document: DocumentModel, nodeSchema: Schema) {
|
||||
const { componentName, id, children, props, ...extras } = nodeSchema;
|
||||
this.id = id || `node_${document.nextId()}`;
|
||||
this.id = id || document.nextId();
|
||||
this.componentName = componentName;
|
||||
if (this.componentName === 'Leaf') {
|
||||
this.props = new Props(this, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user