From 2add8a4ed741e745f727542a5863536f4f51ec69 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Mon, 9 Nov 2020 17:39:41 +0800 Subject: [PATCH] =?UTF-8?q?DEC-15275=20fix:=20=E5=B9=B3=E5=8F=B0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=8F=E7=AB=9F=E7=84=B6=E4=B8=8D=E6=98=AF=E7=A7=BB?= =?UTF-8?q?=E5=87=BA=E4=B8=8D=E6=B6=88=E5=A4=B1=E7=9A=84=EF=BC=8C=E5=8F=8D?= =?UTF-8?q?=E4=BA=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit a57812536db59b0a4dfb9b6a3fc9df9bd60fd60f) --- src/base/combination/combo.js | 82 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 04f4d17bc..c62334058 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -81,7 +81,7 @@ element: this }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { items: [ - {el: this.combo} + { el: this.combo } ] })))); o.isDefaultInit && (this._assertPopupView()); @@ -117,7 +117,7 @@ var enterPopup = false; - function hide (e) { + function hide(e) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) { self._hideView(e); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); @@ -181,45 +181,49 @@ }); break; case "click-hover": - var debounce = BI.debounce(function (e) { - if (self.combo.element.__isMouseInBounds__(e)) { - if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { - // if (self.isViewVisible()) { - // return; - // } - self._popupView(e); - if (self.isViewVisible()) { - self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); - self.fireEvent(BI.Combo.EVENT_EXPAND); + case "click-blur": + // IE走click-hover逻辑 + if (BI.isIE() || ev === "click-hover") { + var debounce = BI.debounce(function (e) { + if (self.combo.element.__isMouseInBounds__(e)) { + if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { + // if (self.isViewVisible()) { + // return; + // } + self._popupView(e); + if (self.isViewVisible()) { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); + self.fireEvent(BI.Combo.EVENT_EXPAND); + } } } - } - }, BI.EVENT_RESPONSE_TIME, { - "leading": true, - "trailing": false - }); - self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { - debounce(e); - st(e); - }); - self.element.on("mouseleave." + self.getName(), function (e) { - if (self.popupView) { - self.popupView.element.on("mouseenter." + self.getName(), function (e) { - enterPopup = true; - self.popupView.element.on("mouseleave." + self.getName(), function (e) { - hide(e); + }, BI.EVENT_RESPONSE_TIME, { + "leading": true, + "trailing": false + }); + self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { + debounce(e); + st(e); + }); + self.element.on("mouseleave." + self.getName(), function (e) { + if (self.popupView) { + self.popupView.element.on("mouseenter." + self.getName(), function (e) { + enterPopup = true; + self.popupView.element.on("mouseleave." + self.getName(), function (e) { + hide(e); + }); + self.popupView.element.off("mouseenter." + self.getName()); }); - self.popupView.element.off("mouseenter." + self.getName()); - }); - BI.defer(function () { - if (!enterPopup) { - hide(e); - } - }, 50); - } - }); - break; - case "click-blur": + BI.defer(function () { + if (!enterPopup) { + hide(e); + } + }, 50); + } + }); + break; + } + var debounce = BI.debounce(function (e) { if (self.combo.element.__isMouseInBounds__(e)) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { @@ -295,7 +299,7 @@ scrolly: false, element: this.options.container || this, items: [ - {el: this.popupView} + { el: this.popupView } ] }); this._rendered = true;