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