Skip to content

Commit 48fda08

Browse files
author
tangjinzhou
committed
fix: ie select open bug #1223
1 parent f58cea1 commit 48fda08

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

components/_util/env.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
// Browser environment sniffing
12
export const inBrowser = typeof window !== 'undefined';
3+
export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
4+
export const weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
25
export const UA = inBrowser && window.navigator.userAgent.toLowerCase();
36
export const isIE = UA && /msie|trident/.test(UA);
47
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0;
8+
export const isEdge = UA && UA.indexOf('edge/') > 0;
9+
export const isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
10+
export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
11+
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
12+
export const isPhantomJS = UA && /phantomjs/.test(UA);
13+
export const isFF = UA && UA.match(/firefox\/(\d+)/);

components/vc-select/Select.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ const Select = {
449449
onArrowClick(e) {
450450
e.stopPropagation();
451451
e.preventDefault();
452+
this.clearBlurTime();
452453
if (!this.disabled) {
453454
this.setOpenState(!this.$data._open, !this.$data._open);
454455
}
@@ -623,6 +624,7 @@ const Select = {
623624
inputBlur(e) {
624625
const target = e.relatedTarget || document.activeElement;
625626
if (
627+
e.relatedTarget === this.$refs.arrow ||
626628
(target &&
627629
this.selectTriggerRef &&
628630
this.selectTriggerRef.getInnerMenu() &&
@@ -685,7 +687,7 @@ const Select = {
685687
}
686688
this.setOpenState(false);
687689
this.$emit('blur', this.getVLForOnChange(value));
688-
}, 10);
690+
}, 200);
689691
},
690692
inputFocus(e) {
691693
if (this.$props.disabled) {
@@ -1412,6 +1414,7 @@ const Select = {
14121414
style={UNSELECTABLE_STYLE}
14131415
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
14141416
onClick={this.onArrowClick}
1417+
ref="arrow"
14151418
>
14161419
{inputIcon || defaultIcon}
14171420
</span>

components/vc-trigger/Trigger.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default {
237237
},
238238

239239
onBlur(e) {
240-
if (!contains(e.target, e.relatedTarget)) {
240+
if (!contains(e.target, e.relatedTarget || document.activeElement)) {
241241
this.fireEvents('blur', e);
242242
this.clearDelayTimer();
243243
if (this.isBlurToHide()) {

0 commit comments

Comments
 (0)