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