Browse Source

feature: items和value支持自动watch

es6
guy 3 years ago
parent
commit
304423c370
  1. 8
      src/base/single/0.single.js

8
src/base/single/0.single.js

@ -46,8 +46,11 @@ BI.Single = BI.inherit(BI.Widget, {
}, },
_init: function () { _init: function () {
BI.Single.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
BI.Single.superclass._init.apply(this, arguments);
if (BI.isKey(o.title) || BI.isKey(o.warningTitle) if (BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({ this.enableHover({
@ -55,9 +58,6 @@ BI.Single = BI.inherit(BI.Widget, {
container: o.container container: o.container
}); });
} }
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
}, },
_clearTimeOut: function () { _clearTimeOut: function () {

Loading…
Cancel
Save