Browse Source

Pull request #2537: 无JIRA任务 feature: reset优化

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '3c834af232264ea7f45905aa9e67c24a442148e8':
  feature: items和value支持自动watch
es6
guy 2 years ago
parent
commit
cb57e201ff
  1. 20
      src/core/4.widget.js

20
src/core/4.widget.js

@ -688,12 +688,17 @@
}, },
__d: function () { __d: function () {
callLifeHook(this, "beforeDestroy");
this.beforeDestroy = null;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount(); widget && widget._unMount && widget._unMount();
}); });
this._children = {}; this._children = {};
},
// 主要是因为_destroy已经提供了protected方法
__destroy: function () {
callLifeHook(this, "beforeDestroy");
this.beforeDestroy = null;
this.__d();
this._parent = null; this._parent = null;
this._isMounted = false; this._isMounted = false;
callLifeHook(this, "destroyed"); callLifeHook(this, "destroyed");
@ -701,16 +706,13 @@
}, },
_unMount: function () { _unMount: function () {
this.__d(); this.__destroy();
this.fireEvent(BI.Events.UNMOUNT); this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners(); this.purgeListeners();
}, },
_empty: function () { _empty: function () {
BI.each(this._children, function (i, widget) { this.__d();
widget && widget._unMount && widget._unMount();
});
this._children = {};
this.element.empty(); this.element.empty();
}, },
@ -748,14 +750,14 @@
}, },
_destroy: function () { _destroy: function () {
this.__d(); this.__destroy();
this.element.destroy(); this.element.destroy();
this.purgeListeners(); this.purgeListeners();
}, },
destroy: function () { destroy: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.__d(); this.__destroy();
if (o.animation) { if (o.animation) {
this._innerSetVisible(false); this._innerSetVisible(false);
setTimeout(function () { setTimeout(function () {

Loading…
Cancel
Save