mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 15:38:32 +00:00
feat: 支持多 pages 的 schema 结构
This commit is contained in:
parent
8029905ffd
commit
d9b5adbc04
@ -32,27 +32,32 @@ const pages = Object.assign(project, {
|
|||||||
if (!pages || !Array.isArray(pages) || pages.length === 0) {
|
if (!pages || !Array.isArray(pages) || pages.length === 0) {
|
||||||
throw new Error('pages schema 不合法');
|
throw new Error('pages schema 不合法');
|
||||||
}
|
}
|
||||||
|
// todo: miniapp
|
||||||
let componentsTree: any;
|
const componentsTree: any = [];
|
||||||
if (isPageDataV1(pages[0])) {
|
pages.forEach((item: any) => {
|
||||||
componentsTree = [pages[0].layout];
|
if (isPageDataV1(item)) {
|
||||||
|
componentsTree.push(item.layout);
|
||||||
} else {
|
} else {
|
||||||
componentsTree = pages[0].componentsTree;
|
componentsTree.push(item.componentsTree[0]);
|
||||||
if (componentsTree[0]) {
|
|
||||||
componentsTree[0].componentName = componentsTree[0].componentName || 'Page';
|
|
||||||
// FIXME
|
|
||||||
if (componentsTree[0].componentName === 'Page' ||
|
|
||||||
componentsTree[0].componentName === 'Component') {
|
|
||||||
componentsTree[0].methods = {};
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
componentsTree.forEach((item: any) => {
|
||||||
|
item.componentName = item.componentName || 'Page';
|
||||||
|
if (item.componentName === 'Page' || item.componentName === 'Component') {
|
||||||
|
item.methods = {};
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
project.load({
|
console.log(pages, componentsTree);
|
||||||
|
|
||||||
|
project.load(
|
||||||
|
{
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
componentsMap: [],
|
componentsMap: [],
|
||||||
componentsTree,
|
componentsTree,
|
||||||
config: project.config
|
config: project.config,
|
||||||
}, true);
|
},
|
||||||
|
true,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
addPage(data: OldPageData | RootSchema) {
|
addPage(data: OldPageData | RootSchema) {
|
||||||
if (isPageDataV1(data)) {
|
if (isPageDataV1(data)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user