From 3d470cad69afb1c761da16dcdadb9bdd6b9c1d19 Mon Sep 17 00:00:00 2001 From: eternalsky Date: Tue, 11 Apr 2023 20:38:45 +0800 Subject: [PATCH] feat: add componentRenderer lifeCycles log --- .../renderer-core/src/renderer/component.tsx | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/renderer-core/src/renderer/component.tsx b/packages/renderer-core/src/renderer/component.tsx index 4be33f5c1..f9f6e8f96 100644 --- a/packages/renderer-core/src/renderer/component.tsx +++ b/packages/renderer-core/src/renderer/component.tsx @@ -47,11 +47,25 @@ export default function componentRendererFactory(): IBaseRenderComponent { return this.__renderComp(Component, this.__renderContextProvider({ compContext: this })); } + getComponentName() { + return this.props?.componentName; + } + /** 需要重载下面几个方法,如果在低代码组件中绑定了对应的生命周期时会出现死循环 */ - componentDidMount() {} - getSnapshotBeforeUpdate() {} - componentDidUpdate() {} - componentWillUnmount() {} - componentDidCatch() {} + componentDidMount() { + this.__debug(`componentDidMount - ${this.getComponentName()}`); + } + getSnapshotBeforeUpdate() { + this.__debug(`getSnapshotBeforeUpdate - ${this.getComponentName()}`); + } + componentDidUpdate() { + this.__debug(`componentDidUpdate - ${this.getComponentName()}`); + } + componentWillUnmount() { + this.__debug(`componentWillUnmount - ${this.getComponentName()}`); + } + componentDidCatch() { + this.__debug(`componentDidCatch - ${this.getComponentName()}`); + } }; }