Browse Source

feature: 内存溢出换一种实现方案

es6
guy 2 years ago
parent
commit
dc906b2a52
  1. 14
      src/core/4.widget.js

14
src/core/4.widget.js

@ -392,7 +392,7 @@
*/
_mount: function (force, deep, lifeHook, predicate, layer) {
var self = this;
if (!force && (this._isMounted || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false;
}
layer = layer || 0;
@ -748,7 +748,16 @@
this.purgeListeners();
},
_assetMounted: function () {
if (!this.isVisible()) {
this._setVisible(true);
this._mount(false, false, false);
this._setVisible(false);
}
},
_empty: function () {
this._assetMounted();
BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount();
});
@ -790,6 +799,7 @@
});
});
this._watchers && (this._watchers = []);
this._assetMounted();
this.__d();
this.element.empty();
this.element.unbind();
@ -799,6 +809,7 @@
},
_destroy: function () {
this._assetMounted();
this.__destroy();
this.element.destroy();
this.purgeListeners();
@ -806,6 +817,7 @@
destroy: function () {
var self = this, o = this.options;
this._assetMounted();
this.__destroy();
if (o.animation) {
this._innerSetVisible(false);

Loading…
Cancel
Save