From ec6a4fb5325b51fcf0cc98d85ee0e5c544f9f2fe Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 26 Oct 2021 17:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6blur=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E4=B8=8D=E9=9A=90=E8=97=8Fcombo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 881480a84..0798ceae2 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -21,6 +21,7 @@ container: null, // popupview放置的容器,默认为this.element isDefaultInit: false, destroyWhenHide: false, + hideWhenBlur: true, hideWhenAnotherComboOpen: false, isNeedAdjustHeight: true, // 是否需要高度调整 isNeedAdjustWidth: true, @@ -291,6 +292,7 @@ }, _hideView: function (e) { + var o = this.options; this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); if (this.options.destroyWhenHide === true) { this.popupView && this.popupView.destroy(); @@ -310,12 +312,12 @@ delete needHideWhenAnotherComboOpen[this.getName()]; BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); - BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); + o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); }, _popupView: function (e) { - var self = this; + var self = this, o = this.options; this._assertPopupViewRender(); this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); // popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下 @@ -334,10 +336,10 @@ this.element.addClass(this.options.comboClass); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); - BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); + o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); BI.Widget._renderEngine.createElement(document).bind("mousedown." + this.getName(), BI.bind(this._hideIf, this)).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this)); - BI.Widget._renderEngine.createElement(window).bind("blur." + this.getName(), BI.bind(this._hideIf, this)); + o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).bind("blur." + this.getName(), BI.bind(this._hideIf, this)); this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW); },