feat: select suggestion on enter key for autocomplete
This commit is contained in:
@@ -150,6 +150,16 @@ export default defineComponent({
|
|||||||
|
|
||||||
handleKeystroke(event) {
|
handleKeystroke(event) {
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
|
case "Enter":
|
||||||
|
event.preventDefault()
|
||||||
|
if (this.currentSuggestionIndex > -1)
|
||||||
|
this.forceSuggestion(
|
||||||
|
this.suggestions.find(
|
||||||
|
(_item, index) => index === this.currentSuggestionIndex
|
||||||
|
)
|
||||||
|
)
|
||||||
|
break
|
||||||
|
|
||||||
case "ArrowUp":
|
case "ArrowUp":
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.currentSuggestionIndex =
|
this.currentSuggestionIndex =
|
||||||
|
|||||||
Reference in New Issue
Block a user