Browse Source

重新调整逻辑

es6
windy 4 years ago
parent
commit
e351830a0c
  1. 1
      changelog.md
  2. 38
      src/base/single/__test__/text.test.js
  3. 1
      src/base/single/button/button.basic.js
  4. 1
      src/base/single/label/abstract.label.js
  5. 10
      src/base/single/text.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-11) 2.0(2020-11)
- 修复了文本标签text传递空字符串后显示value值的问题
- 限制了title的最大高度 - 限制了title的最大高度
- bi.textarea_editor添加setWatermark方法 - bi.textarea_editor添加setWatermark方法
- 生命周期可以通过属性传递来操作 - 生命周期可以通过属性传递来操作

38
src/base/single/__test__/text.test.js

@ -154,4 +154,42 @@ describe("TextTest", function () {
done(); done();
}); });
}); });
/**
* test_author_windy
*/
it("text的value属性", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "",
value: "aaaa"
});
expect(text.element.text()).to.equal("");
text.destroy();
});
/**
* test_author_windy
*/
it("text的value属性1", function () {
var text = BI.Test.createWidget({
type: "bi.text",
value: "aaaa"
});
expect(text.element.text()).to.equal("aaaa");
text.destroy();
});
/**
* test_author_windy
*/
it("text的value属性2", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: null,
value: "aaaa"
});
expect(text.element.text()).to.equal("");
text.destroy();
});
}); });

1
src/base/single/button/button.basic.js

@ -11,7 +11,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""), _baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""),
value: "", value: "",
text: "",
stopEvent: false, stopEvent: false,
stopPropagation: false, stopPropagation: false,
selected: false, selected: false,

1
src/base/single/label/abstract.label.js

@ -17,7 +17,6 @@
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
text: "",
highLight: false, highLight: false,
handler: null handler: null
}); });

10
src/base/single/text.js

@ -18,7 +18,6 @@
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
text: "",
py: "", py: "",
highLight: false highLight: false
}, },
@ -78,7 +77,7 @@
} }
var text = this._getShowText(); var text = this._getShowText();
if (BI.isKey(text)) { if (!BI.isUndefined(text)) {
this.setText(text); this.setText(text);
} else if (BI.isKey(o.value)) { } else if (BI.isKey(o.value)) {
this.setText(o.value); this.setText(o.value);
@ -105,11 +104,8 @@
_getShowText: function () { _getShowText: function () {
var o = this.options; var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text; var text = BI.isFunction(o.text) ? o.text() : o.text;
text = BI.isKey(text) ? text : o.value;
if (!BI.isKey(text)) { return BI.isKey(text) ? BI.Text.formatText(text + "") : text;
return "";
}
return BI.Text.formatText(text + "");
}, },
_doRedMark: function (keyword) { _doRedMark: function (keyword) {

Loading…
Cancel
Save