From 33c826ec166c2efbb40aef493f4810baf2214eb2 Mon Sep 17 00:00:00 2001 From: Rookie_Zoe Date: Mon, 7 Jan 2019 12:24:48 +0800 Subject: [PATCH 1/5] fix #5150 --- examples/routers/auto-complete.vue | 73 +++++++++++++++--------------- src/components/select/select.vue | 13 +++++- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/examples/routers/auto-complete.vue b/examples/routers/auto-complete.vue index 0ecd673f..6d3cb96a 100644 --- a/examples/routers/auto-complete.vue +++ b/examples/routers/auto-complete.vue @@ -1,40 +1,41 @@ \ No newline at end of file + }, + methods: {}, + created() { + setTimeout(() => { + this.value = "1.0.0.5"; + this.data = [ + "12412515", + "123444", + "12355", + "12345", + "12312", + "1234", + "123", + "111", + "5.2.3.4", + "1.2.3.4", + "1.2.3.4.5", + "1.2.3.4.5.6", + "1.2.3.4.5.6.7", + "1.0.0.8", + "1.0.0.5", + "whb-03" + ]; + // this.disabled = true; + }, 1000); + } +}; + diff --git a/src/components/select/select.vue b/src/components/select/select.vue index d446a8ad..8a7752a6 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -635,7 +635,18 @@ }, ANIMATION_TIMEOUT); }, onQueryChange(query) { - if (query.length > 0 && query !== this.query) this.visible = true; + if (query.length > 0 && query !== this.query) { + // in 'AutoComplete', when set an initial value asynchronously, + // the 'dropdown list' should be stay hidden. + // [issue #5150] + let isInputFocused = + document.hasFocus && + document.hasFocus() && + document.activeElement === this.$el.querySelector('input'); + + this.visible = isInputFocused; + } + this.query = query; this.unchangedQuery = this.visible; this.filterQueryChange = true; From 5f25fecafbdc5044be16f13360923050925787a2 Mon Sep 17 00:00:00 2001 From: Aresn Date: Mon, 7 Jan 2019 14:28:43 +0800 Subject: [PATCH 2/5] Update select.vue --- src/components/select/select.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 8a7752a6..18ace4d4 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -639,12 +639,15 @@ // in 'AutoComplete', when set an initial value asynchronously, // the 'dropdown list' should be stay hidden. // [issue #5150] - let isInputFocused = - document.hasFocus && - document.hasFocus() && - document.activeElement === this.$el.querySelector('input'); - - this.visible = isInputFocused; + if (this.autoComplete) { + let isInputFocused = + document.hasFocus && + document.hasFocus() && + document.activeElement === this.$el.querySelector('input'); + this.visible = isInputFocused; + } else { + this.visible = true; + } } this.query = query; From 9d767f2084ca54417f0f0b1385b713626685c611 Mon Sep 17 00:00:00 2001 From: Aresn Date: Mon, 7 Jan 2019 14:29:32 +0800 Subject: [PATCH 3/5] Update auto-complete.vue --- examples/routers/auto-complete.vue | 71 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/examples/routers/auto-complete.vue b/examples/routers/auto-complete.vue index 6d3cb96a..ba8cc5c5 100644 --- a/examples/routers/auto-complete.vue +++ b/examples/routers/auto-complete.vue @@ -1,41 +1,40 @@