fix: ie select open bug #1223

pull/1236/head
tangjinzhou 2019-09-27 18:44:11 +08:00
parent f58cea1dff
commit 48fda08795
3 changed files with 14 additions and 2 deletions

View File

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

View File

@ -449,6 +449,7 @@ const Select = {
onArrowClick(e) { onArrowClick(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.clearBlurTime();
if (!this.disabled) { if (!this.disabled) {
this.setOpenState(!this.$data._open, !this.$data._open); this.setOpenState(!this.$data._open, !this.$data._open);
} }
@ -623,6 +624,7 @@ const Select = {
inputBlur(e) { inputBlur(e) {
const target = e.relatedTarget || document.activeElement; const target = e.relatedTarget || document.activeElement;
if ( if (
e.relatedTarget === this.$refs.arrow ||
(target && (target &&
this.selectTriggerRef && this.selectTriggerRef &&
this.selectTriggerRef.getInnerMenu() && this.selectTriggerRef.getInnerMenu() &&
@ -685,7 +687,7 @@ const Select = {
} }
this.setOpenState(false); this.setOpenState(false);
this.$emit('blur', this.getVLForOnChange(value)); this.$emit('blur', this.getVLForOnChange(value));
}, 10); }, 200);
}, },
inputFocus(e) { inputFocus(e) {
if (this.$props.disabled) { if (this.$props.disabled) {
@ -1412,6 +1414,7 @@ const Select = {
style={UNSELECTABLE_STYLE} style={UNSELECTABLE_STYLE}
{...{ attrs: UNSELECTABLE_ATTRIBUTE }} {...{ attrs: UNSELECTABLE_ATTRIBUTE }}
onClick={this.onArrowClick} onClick={this.onArrowClick}
ref="arrow"
> >
{inputIcon || defaultIcon} {inputIcon || defaultIcon}
</span> </span>

View File

@ -237,7 +237,7 @@ export default {
}, },
onBlur(e) { onBlur(e) {
if (!contains(e.target, e.relatedTarget)) { if (!contains(e.target, e.relatedTarget || document.activeElement)) {
this.fireEvents('blur', e); this.fireEvents('blur', e);
this.clearDelayTimer(); this.clearDelayTimer();
if (this.isBlurToHide()) { if (this.isBlurToHide()) {