From 3d3f07c437ce0b8d29ab0a12caed8f3bf6f67157 Mon Sep 17 00:00:00 2001 From: Guyi Date: Thu, 19 Nov 2020 10:07:06 +0800 Subject: [PATCH] =?UTF-8?q?QFX-3006=20fix=EF=BC=9Astate=5Feditor=E4=B8=AD?= =?UTF-8?q?=E7=9A=84defaultText=E6=94=AF=E6=8C=81=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/editor.state.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index a41ea6df0a..450a08f2f8 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -244,6 +244,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { setState: function (v) { var o = this.options; + var defaultText = BI.isFunction(o.defaultText) ? o.defaultText() : o.defaultText; BI.StateEditor.superclass.setValue.apply(this, arguments); this.stateValue = v; if (BI.isNumber(v)) { @@ -254,21 +255,21 @@ BI.StateEditor = BI.inherit(BI.Widget, { this._setText(BI.i18nText("BI-Select_Part")); this.text.element.removeClass("bi-water-mark"); } else { - this._setText(BI.isKey(o.defaultText) ? o.defaultText : o.text); - BI.isKey(o.defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); + this._setText(BI.isKey(defaultText) ? defaultText : o.text); + BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); } return; } if (BI.isString(v)) { this._setText(v); // 配置了defaultText才判断标灰,其他情况不标灰 - (BI.isKey(o.defaultText) && o.defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); + (BI.isKey(defaultText) && defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { - this._setText(BI.isKey(o.defaultText) ? o.defaultText : o.text); - BI.isKey(o.defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); + this._setText(BI.isKey(defaultText) ? defaultText : o.text); + BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); } else if (v.length === 1) { this._setText(v[0]); this.text.element.removeClass("bi-water-mark");