Browse Source

无JIRA任务 修改组件destory生命周期,确保所有组件的ref都会被调用

es6
zsmj 2 years ago
parent
commit
3bda92fd85
  1. 4
      src/core/3.ob.js
  2. 3
      src/core/4.widget.js

4
src/core/3.ob.js

@ -90,11 +90,11 @@
//释放当前对象 //释放当前对象
_purgeRef: function () { _purgeRef: function () {
if (this.options.__ref) { if (this.options.__ref) {
this.options.__ref.call(null); this.options.__ref.call(null, null);
this.options.__ref = null; this.options.__ref = null;
} }
if (this.options.ref) { if (this.options.ref) {
this.options.ref.call(null); this.options.ref.call(null, null);
this.options.ref = null; this.options.ref = null;
} }
}, },

3
src/core/4.widget.js

@ -738,12 +738,13 @@
callLifeHook(this, "destroyed"); callLifeHook(this, "destroyed");
this.destroyed = null; this.destroyed = null;
this._isDestroyed = true; this._isDestroyed = true;
this._purgeRef();
this.purgeListeners();
}, },
_unMount: function () { _unMount: function () {
this.__destroy(); this.__destroy();
this.fireEvent(BI.Events.UNMOUNT); this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners();
}, },
_empty: function () { _empty: function () {

Loading…
Cancel
Save