Browse Source

Pull request #2155: 无JIAR任务 整理代码

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

* commit '1883e07671e8034bc4c2f9ef95a5e16c5425e81f':
  整理代码
es6
guy 3 years ago
parent
commit
675edd02ea
  1. 4
      src/core/3.ob.js
  2. 10
      src/core/4.widget.js

4
src/core/3.ob.js

@ -73,10 +73,10 @@
// 获得一个当前对象的引用 // 获得一个当前对象的引用
_initRef: function () { _initRef: function () {
if (this.options.__ref) { if (this.options.__ref) {
this.options.__ref.call(this, this); this.options.__ref.call(this, this.$delegate || this);
} }
if (this.options.ref) { if (this.options.ref) {
this.options.ref.call(this, this); this.options.ref.call(this);
} }
}, },

10
src/core/4.widget.js

@ -52,8 +52,14 @@
_constructed: function () { _constructed: function () {
if (this.setup) { if (this.setup) {
pushTarget(this); pushTarget(this);
this.service = this.setup(this.options); var delegate = this.setup(this.options);
this.render = BI.isPlainObject(this.service) ? this.service.render : this.service; if (BI.isPlainObject(delegate)) {
this.render = delegate.render;
// setup返回一个json,即对外暴露的方法
this.$delegate = delegate;
} else {
this.render = delegate;
}
popTarget(); popTarget();
} }
}, },

Loading…
Cancel
Save