mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-07 02:47:12 +00:00
event load schema
This commit is contained in:
parent
ddaf8b66ff
commit
096603cb45
@ -234,6 +234,7 @@ export default class SourceEditor extends Component<{
|
|||||||
let functionMap = transfrom.code2Schema(newCode);
|
let functionMap = transfrom.code2Schema(newCode);
|
||||||
let schema = editor.get('designer').project.getSchema();
|
let schema = editor.get('designer').project.getSchema();
|
||||||
let newSchema = transfrom.setFunction2Schema(functionMap,schema);
|
let newSchema = transfrom.setFunction2Schema(functionMap,schema);
|
||||||
|
editor.get('designer').project.load(newSchema);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -40,15 +40,11 @@ const transfrom = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(JSON.stringify(a.state));
|
|
||||||
|
|
||||||
console.log(functionMap);
|
|
||||||
|
|
||||||
if (a.state){
|
if (a.state){
|
||||||
functionMap.state = a.state
|
functionMap.state = a.state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return functionMap;
|
return functionMap;
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -63,12 +59,33 @@ const transfrom = {
|
|||||||
if (key == 'state'){
|
if (key == 'state'){
|
||||||
pageNode.state = functionMap[key];
|
pageNode.state = functionMap[key];
|
||||||
}else{
|
}else{
|
||||||
|
// 判断是否属于lifeCycles节点
|
||||||
if (LIFECYCLES_FUNCTION_MAP.react.indexOf(key)>=0){
|
if (LIFECYCLES_FUNCTION_MAP.react.indexOf(key)>=0){
|
||||||
// 判断有没有lifecycles节点
|
// 判断有没有lifecycles节点
|
||||||
|
if (!pageNode.lifeCycles){
|
||||||
|
pageNode.lifeCycles = {}
|
||||||
|
}else{
|
||||||
|
pageNode.lifeCycles[key] = {
|
||||||
|
"type": "JSFunction",
|
||||||
|
"value": functionMap[key],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// methods节点
|
||||||
|
if (!pageNode.methods){
|
||||||
|
pageNode.methods = {}
|
||||||
|
}else{
|
||||||
|
pageNode.methods[key] = {
|
||||||
|
"type": "JSFunction",
|
||||||
|
"value": functionMap[key],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return schema;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user