Commit 5268a8f8 authored by leezng's avatar leezng Committed by 杨奕

Autocomplete: Don't prevent form submit

parent 7753bd89
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@focus="handleFocus" @focus="handleFocus"
@keydown.up.native.prevent="highlight(highlightedIndex - 1)" @keydown.up.native.prevent="highlight(highlightedIndex - 1)"
@keydown.down.native.prevent="highlight(highlightedIndex + 1)" @keydown.down.native.prevent="highlight(highlightedIndex + 1)"
@keydown.enter.native.prevent="handleKeyEnter" @keydown.enter.native="handleKeyEnter"
@keydown.native.tab="close" @keydown.native.tab="close"
> >
<template slot="prepend" v-if="$slots.prepend"> <template slot="prepend" v-if="$slots.prepend">
...@@ -133,8 +133,9 @@ ...@@ -133,8 +133,9 @@
close(e) { close(e) {
this.activated = false; this.activated = false;
}, },
handleKeyEnter() { handleKeyEnter(e) {
if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) { if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
e.preventDefault()
this.select(this.suggestions[this.highlightedIndex]); this.select(this.suggestions[this.highlightedIndex]);
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment