mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 01:48:18 +00:00
fix: 修复获取 currentPage 的逻辑
This commit is contained in:
parent
4642f2dd99
commit
d8221dbfe7
@ -107,6 +107,9 @@ export class DocumentModel {
|
|||||||
this._blank = true;
|
this._blank = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 兼容 vision
|
||||||
|
this.id = project.getSchema()?.id || this.id;
|
||||||
|
|
||||||
this.rootNode = this.createNode<RootNode>(
|
this.rootNode = this.createNode<RootNode>(
|
||||||
schema || {
|
schema || {
|
||||||
componentName: 'Page',
|
componentName: 'Page',
|
||||||
@ -145,7 +148,7 @@ export class DocumentModel {
|
|||||||
* 生成唯一id
|
* 生成唯一id
|
||||||
*/
|
*/
|
||||||
nextId() {
|
nextId() {
|
||||||
return this.id + (++this.seqId).toString(36).toLocaleLowerCase();
|
return (this.id.slice(-10) + (++this.seqId).toString(36)).toLocaleLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -86,12 +86,7 @@ const pages = Object.assign(project, {
|
|||||||
page.active();
|
page.active();
|
||||||
},
|
},
|
||||||
getCurrentPage() {
|
getCurrentPage() {
|
||||||
if (!project.currentDocument) {
|
return project.currentDocument;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const currentPage = { ...project.currentDocument, id: project.getSchema().id };
|
|
||||||
Object.setPrototypeOf(currentPage, Object.getPrototypeOf(project.currentDocument || {}));
|
|
||||||
return currentPage;
|
|
||||||
},
|
},
|
||||||
onPagesChange() {
|
onPagesChange() {
|
||||||
// noop
|
// noop
|
||||||
@ -106,7 +101,7 @@ const pages = Object.assign(project, {
|
|||||||
|
|
||||||
Object.defineProperty(pages, 'currentPage', {
|
Object.defineProperty(pages, 'currentPage', {
|
||||||
get() {
|
get() {
|
||||||
return pages.getCurrentPage();
|
return project.currentDocument;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user