Browse Source

Merge pull request #197541 in DEC/fineui from master to feature/x

* commit 'fb8015360a7707307c0345503e1a52e28ec15d08':
  feature: 支持ref属性传个对象,不用传函数
research/test
superman 2 years ago
parent
commit
0e099b859c
  1. 24
      src/core/3.ob.js

24
src/core/3.ob.js

@ -79,23 +79,25 @@
// 获得一个当前对象的引用
_initRef: function () {
if (this.options.__ref) {
this.options.__ref.call(this, this);
var o = this.options;
if (o.__ref) {
BI.isFunction(o.__ref) ? o.__ref.call(this, this) : o.__ref.current = this;
}
if (this.options.ref) {
this.options.ref.call(this, this);
if (o.ref) {
BI.isFunction(o.ref) ? o.ref.call(this, this) : o.ref.current = this;
}
},
//释放当前对象
_purgeRef: function () {
if (this.options.__ref) {
this.options.__ref.call(null, null);
this.options.__ref = null;
}
if (this.options.ref) {
this.options.ref.call(null, null);
this.options.ref = null;
var o = this.options;
if (o.__ref) {
BI.isFunction(o.__ref) ? o.__ref.call(null, null) : o.__ref.current = null;
o.__ref = null;
}
if (o.ref) {
BI.isFunction(o.ref) ? o.ref.call(null, null) : o.ref.current = null;
o.ref = null;
}
},

Loading…
Cancel
Save