Browse Source

Pull request #1818: 无JIRA任务 增加组件默认populate方法

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

* commit 'af7615aad7e97dc38dbafca0a5bd394dc53c565e':
  增加组件默认populate方法
  增加组件默认populate方法
es6
guy 3 years ago
parent
commit
c88ac8a587
  1. 38
      src/core/widget.js

38
src/core/widget.js

@ -125,6 +125,22 @@
callLifeHook(this, "created");
},
_initCurrent: function () {
var o = this.options;
if (o._baseCls || o.baseCls || o.extraCls || o.cls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || ""));
}
if (o.attributes) {
this.element.attr(o.attributes);
}
if (o.data) {
this.element.data(o.data);
}
if (o.css) {
this.element.css(o.css);
}
},
/**
* 初始化根节点
* @private
@ -152,18 +168,7 @@
this.element = BI.Widget._renderEngine.createElement(this);
}
this.element._isWidget = true;
if (o._baseCls || o.baseCls || o.extraCls || o.cls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || ""));
}
if (o.attributes) {
this.element.attr(o.attributes);
}
if (o.data) {
this.element.data(o.data);
}
if (o.css) {
this.element.css(o.css);
}
this._initCurrent();
},
_initElementWidth: function () {
@ -559,6 +564,15 @@
this.element.empty();
},
// 默认的populate方法就是干掉重来
populate: function () {
this.purgeListeners();
this.empty();
this._initCurrent();
this._init();
this._initRef();
},
_destroy: function () {
this.__d();
this.element.destroy();

Loading…
Cancel
Save