Browse Source

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

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

6
src/core/3.ob.js

@ -1,5 +1,5 @@
!(function () {
function extend () {
function extend() {
var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy;
for (; i < length; i++) {
// Only deal with non-null/undefined values
@ -90,11 +90,11 @@
//释放当前对象
_purgeRef: function () {
if (this.options.__ref) {
this.options.__ref.call(null);
this.options.__ref.call(null, null);
this.options.__ref = null;
}
if (this.options.ref) {
this.options.ref.call(null);
this.options.ref.call(null, null);
this.options.ref = null;
}
},

3
src/core/4.widget.js

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

Loading…
Cancel
Save