feat: select suggestion on enter key for autocomplete
This commit is contained in:
parent
9082152f1a
commit
827a95515d
1 changed files with 10 additions and 0 deletions
|
|
@ -150,6 +150,16 @@ export default defineComponent({
|
|||
|
||||
handleKeystroke(event) {
|
||||
switch (event.code) {
|
||||
case "Enter":
|
||||
event.preventDefault()
|
||||
if (this.currentSuggestionIndex > -1)
|
||||
this.forceSuggestion(
|
||||
this.suggestions.find(
|
||||
(_item, index) => index === this.currentSuggestionIndex
|
||||
)
|
||||
)
|
||||
break
|
||||
|
||||
case "ArrowUp":
|
||||
event.preventDefault()
|
||||
this.currentSuggestionIndex =
|
||||
|
|
|
|||
Loading…
Reference in a new issue