feat: low-code components support lifecycle and function execution

This commit is contained in:
liujuping 2022-04-28 14:23:15 +08:00 committed by LeoYuan 袁力皓
parent 3d176cb534
commit 176583f48a
3 changed files with 9 additions and 4 deletions

View File

@ -501,8 +501,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
const _schema: any = {
...compatibleLegaoSchema(schema),
};
_schema.methods = {};
_schema.lifeCycles = {};
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
const doc = window.document;

View File

@ -428,8 +428,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
const _schema: any = {
...compatibleLegaoSchema(schema),
};
_schema.methods = {};
_schema.lifeCycles = {};
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
const doc = window.document;

View File

@ -32,6 +32,8 @@ export default function componentRendererFactory(): IBaseRenderComponent {
const noContainer = this.__parseData(__schema.props?.noContainer);
this.__bindCustomMethods(this.props);
if (noContainer) {
return this.__renderContextProvider({ compContext: this });
}
@ -44,5 +46,12 @@ export default function componentRendererFactory(): IBaseRenderComponent {
return this.__renderComp(Component, this.__renderContextProvider({ compContext: this }));
}
/** 需要重载下面几个方法,如果在低代码组件中绑定了对应的生命周期时会出现死循环 */
componentDidMount() {}
getSnapshotBeforeUpdate() {}
componentDidUpdate() {}
componentWillUnmount() {}
componentDidCatch() {}
};
}