diff --git a/src/base/single/0.single.js b/src/base/single/0.single.js index f244f200f..9b4b4d118 100644 --- a/src/base/single/0.single.js +++ b/src/base/single/0.single.js @@ -17,7 +17,8 @@ BI.Single = BI.inherit(BI.Widget, { title: null, warningTitle: null, tipType: null, // success或warning - belowMouse: false // title是否跟随鼠标 + belowMouse: false, // title是否跟随鼠标 + enableHover: false }); }, @@ -57,7 +58,7 @@ BI.Single = BI.inherit(BI.Widget, { self.setValue(newValue); }) : o.value; BI.Single.superclass._init.apply(this, arguments); - if (BI.isKey(o.title) || BI.isKey(o.warningTitle) + if (o.enableHover || BI.isKey(o.title) || BI.isKey(o.warningTitle) || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { this.enableHover({ belowMouse: o.belowMouse, diff --git a/src/base/single/label/abstract.label.js b/src/base/single/label/abstract.label.js index 76fb27fbd..46e5e7969 100644 --- a/src/base/single/label/abstract.label.js +++ b/src/base/single/label/abstract.label.js @@ -18,10 +18,27 @@ tgap: 0, bgap: 0, highLight: false, - handler: null + handler: null, + enableHover: props.title !== null, }); }, + getTitle: function () { + var title = this.options.title; + var text = this.options.text; + if (BI.isFunction(title)) { + return title(); + } + if (BI.isNotNull(title)) { + return title; + } + + if (BI.isFunction(text)) { + return text(); + } + return text; + }, + _createJson: function () { var o = this.options; return { @@ -374,6 +391,7 @@ setValue: function (v) { BI.AbstractLabel.superclass.setValue.apply(this, arguments); if (!this.isReadOnly()) { + this.options.text = v; this.text.setValue(v); } }