Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
ed72c389
Commit
ed72c389
authored
Jun 04, 2017
by
baiyaaaaa
Committed by
杨奕
Jul 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix autocomplete blur bug
This reverts commit
876cb88a
.
parent
84c81ff9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
packages/autocomplete/src/autocomplete.vue
packages/autocomplete/src/autocomplete.vue
+6
-7
test/unit/specs/autocomplete.spec.js
test/unit/specs/autocomplete.spec.js
+3
-3
No files found.
packages/autocomplete/src/autocomplete.vue
View file @
ed72c389
<
template
>
<div
class=
"el-autocomplete"
>
<div
class=
"el-autocomplete"
v-clickoutside=
"close"
>
<el-input
ref=
"input"
:value=
"value"
...
...
@@ -14,7 +14,6 @@
@
compositionend.native=
"handleComposition"
@
change=
"handleChange"
@
focus=
"handleFocus"
@
blur=
"handleBlur"
@
keydown.up.native.prevent=
"highlight(highlightedIndex - 1)"
@
keydown.down.native.prevent=
"highlight(highlightedIndex + 1)"
@
keydown.enter.native.prevent=
"handleKeyEnter"
...
...
@@ -37,6 +36,7 @@
</template>
<
script
>
import
ElInput
from
'
element-ui/packages/input
'
;
import
Clickoutside
from
'
element-ui/src/utils/clickoutside
'
;
import
ElAutocompleteSuggestions
from
'
./autocomplete-suggestions.vue
'
;
import
Emitter
from
'
element-ui/src/mixins/emitter
'
;
...
...
@@ -52,6 +52,8 @@
ElAutocompleteSuggestions
},
directives
:
{
Clickoutside
},
props
:
{
props
:
{
type
:
Object
,
...
...
@@ -133,11 +135,8 @@
this
.
getData
(
this
.
value
);
}
},
handleBlur
()
{
// 因为 blur 事件处理优先于 select 事件执行
setTimeout
(
_
=>
{
this
.
isFocus
=
false
;
},
100
);
close
()
{
this
.
isFocus
=
false
;
},
handleKeyEnter
()
{
if
(
this
.
suggestionVisible
&&
this
.
highlightedIndex
>=
0
&&
this
.
highlightedIndex
<
this
.
suggestions
.
length
)
{
...
...
test/unit/specs/autocomplete.spec.js
View file @
ed72c389
import
{
createVue
,
destroyVM
}
from
'
../util
'
;
import
{
createVue
,
triggerClick
,
destroyVM
}
from
'
../util
'
;
describe
(
'
Autocomplete
'
,
()
=>
{
let
vm
;
...
...
@@ -59,11 +59,11 @@ describe('Autocomplete', () => {
expect
(
suggestions
.
style
.
display
).
to
.
not
.
equal
(
'
none
'
);
expect
(
suggestions
.
querySelectorAll
(
'
.el-autocomplete-suggestion__list li
'
).
length
).
to
.
be
.
equal
(
4
);
inputElm
.
blur
(
);
triggerClick
(
document
);
setTimeout
(
_
=>
{
expect
(
suggestions
.
style
.
display
).
to
.
be
.
equal
(
'
none
'
);
done
();
},
6
00
);
},
5
00
);
},
500
);
});
it
(
'
select
'
,
done
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment