Browse Source

AutoComplete: fix key enter (#2672)

kingwl 8 years ago
parent
commit
f25b8b1edb
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/autocomplete/src/autocomplete.vue

+ 2 - 2
packages/autocomplete/src/autocomplete.vue

@@ -19,7 +19,7 @@
       </template>
       <template slot="append" v-if="$slots.append">
         <slot name="append"></slot>
-      </template> 
+      </template>
     </el-input>
     <el-autocomplete-suggestions
       :class="[popperClass ? popperClass : '']"
@@ -113,7 +113,7 @@
         }, 100);
       },
       handleKeyEnter() {
-        if (this.suggestionVisible) {
+        if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
           this.select(this.suggestions[this.highlightedIndex]);
         }
       },