GeezerVison is showing github.com — feat: low-code components support lifecycle and function execution · shibiaoz/lowcode-engine@176583f
File tree
Expand file treeCollapse file tree
Open diff view settings
rax-simulator-renderer/src react-simulator-renderer/src renderer-core/src/renderer
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/rax-simulator-renderer/src/renderer.ts -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -501,8 +501,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { |
501 | 501 | const _schema: any = { |
502 | 502 | ...compatibleLegaoSchema(schema), |
503 | 503 | }; |
504 | | - _schema.methods = {}; |
505 | | - _schema.lifeCycles = {}; |
506 | 504 |
|
507 | 505 | if (schema.componentName === 'Component' && (schema as ComponentSchema).css) { |
508 | 506 | const doc = window.document; |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/react-simulator-renderer/src/renderer.ts -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -428,8 +428,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { |
428 | 428 | const _schema: any = { |
429 | 429 | ...compatibleLegaoSchema(schema), |
430 | 430 | }; |
431 | | - _schema.methods = {}; |
432 | | - _schema.lifeCycles = {}; |
433 | 431 |
|
434 | 432 | if (schema.componentName === 'Component' && (schema as ComponentSchema).css) { |
435 | 433 | const doc = window.document; |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/component.tsx +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,6 +32,8 @@ export default function componentRendererFactory(): IBaseRenderComponent { |
32 | 32 |
|
33 | 33 | const noContainer = this.__parseData(__schema.props?.noContainer); |
34 | 34 |
|
| 35 | + this.__bindCustomMethods(this.props); |
| 36 | + |
35 | 37 | if (noContainer) { |
36 | 38 | return this.__renderContextProvider({ compContext: this }); |
37 | 39 | } |
@@ -44,5 +46,12 @@ export default function componentRendererFactory(): IBaseRenderComponent { |
44 | 46 |
|
45 | 47 | return this.__renderComp(Component, this.__renderContextProvider({ compContext: this })); |
46 | 48 | } |
| 49 | + |
| 50 | + /** 需要重载下面几个方法,如果在低代码组件中绑定了对应的生命周期时会出现死循环 */ |
| 51 | + componentDidMount() {} |
| 52 | + getSnapshotBeforeUpdate() {} |
| 53 | + componentDidUpdate() {} |
| 54 | + componentWillUnmount() {} |
| 55 | + componentDidCatch() {} |
47 | 56 | }; |
48 | 57 | } |