Skip to content

Commit 176583f

Browse files
liujupingLeoYuan
authored andcommitted
feat: low-code components support lifecycle and function execution
1 parent 3d176cb commit 176583f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/rax-simulator-renderer/src/renderer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
501501
const _schema: any = {
502502
...compatibleLegaoSchema(schema),
503503
};
504-
_schema.methods = {};
505-
_schema.lifeCycles = {};
506504

507505
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
508506
const doc = window.document;

packages/react-simulator-renderer/src/renderer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
428428
const _schema: any = {
429429
...compatibleLegaoSchema(schema),
430430
};
431-
_schema.methods = {};
432-
_schema.lifeCycles = {};
433431

434432
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
435433
const doc = window.document;

packages/renderer-core/src/renderer/component.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export default function componentRendererFactory(): IBaseRenderComponent {
3232

3333
const noContainer = this.__parseData(__schema.props?.noContainer);
3434

35+
this.__bindCustomMethods(this.props);
36+
3537
if (noContainer) {
3638
return this.__renderContextProvider({ compContext: this });
3739
}
@@ -44,5 +46,12 @@ export default function componentRendererFactory(): IBaseRenderComponent {
4446

4547
return this.__renderComp(Component, this.__renderContextProvider({ compContext: this }));
4648
}
49+
50+
/** 需要重载下面几个方法,如果在低代码组件中绑定了对应的生命周期时会出现死循环 */
51+
componentDidMount() {}
52+
getSnapshotBeforeUpdate() {}
53+
componentDidUpdate() {}
54+
componentWillUnmount() {}
55+
componentDidCatch() {}
4756
};
4857
}

0 commit comments

Comments
 (0)