diff --git a/packages/fineui/src/core/4.widget.js b/packages/fineui/src/core/4.widget.js index df12ef774..8fe60098a 100644 --- a/packages/fineui/src/core/4.widget.js +++ b/packages/fineui/src/core/4.widget.js @@ -240,8 +240,11 @@ export class Widget extends OB { ).call(this, render); if (beforeRenderResult instanceof Promise) { beforeRenderResult.then(render).catch((e) => { - _global.console && console.error(e); - !this.isDestroyed() && render(); // 异步render,改组件此时可能已经被销毁 + if (!this.isDestroyed()) { + render(); // 异步render,组件此时可能已经被销毁 + } else { + _global.console && console.error(e, 'Async render error! Widget has been destroyed!'); + } }); } } else { @@ -257,8 +260,11 @@ export class Widget extends OB { ).call(this, init); if (beforeInitResult instanceof Promise) { beforeInitResult.then(init).catch((e) => { - _global.console && console.error(e); - !this.isDestroyed() && init(); // 异步render,改组件此时可能已经被销毁 + if (!this.isDestroyed()) { + init(); // 异步init,组件此时可能已经被销毁 + } else { + _global.console && console.error(e, 'Async init error! Widget has been destroyed!'); + } }); } } else { @@ -874,7 +880,7 @@ export class Widget extends OB { this._assetMounted(); this.__destroy(); this.fireEvent(Events.UNMOUNT); - // this._purgeRef(); // 子组件unmount ref置为null了,父组件拿不到ref,导致报错 + this._purgeRef(); // 子组件unmount ref置为null了,父组件拿不到ref,导致报错 this.purgeListeners(); }