Commit eae5f2b zhiyang
committed
1 parent df7bbe2 commit eae5f2b Copy full SHA for eae5f2b
File tree 1 file changed +9
-5
lines changed
packages/autocomplete/src
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 122
122
activated: false ,
123
123
suggestions: [],
124
124
loading: false ,
125
- highlightedIndex: - 1
125
+ highlightedIndex: - 1 ,
126
+ suggestionDisabled: false
126
127
};
127
128
},
128
129
computed: {
153
154
this .loading = true ;
154
155
this .fetchSuggestions (queryString, (suggestions ) => {
155
156
this .loading = false ;
157
+ if (this .suggestionDisabled ) {
158
+ return ;
159
+ }
156
160
if (Array .isArray (suggestions)) {
157
161
this .suggestions = suggestions;
158
162
} else {
159
- console .error (' autocomplete suggestions must be an array' );
163
+ console .error (' [Element Warn][Autocomplete] autocomplete suggestions must be an array' );
160
164
}
161
165
});
162
166
},
163
167
handleChange (value ) {
164
168
this .$emit (' input' , value);
169
+ this .suggestionDisabled = false ;
165
170
if (! this .triggerOnFocus && ! value) {
171
+ this .suggestionDisabled = true ;
166
172
this .suggestions = [];
167
173
return ;
168
174
}
228
234
}
229
235
},
230
236
mounted () {
231
- this .debouncedGetData = debounce (this .debounce , (val ) => {
232
- this .getData (val);
233
- });
237
+ this .debouncedGetData = debounce (this .debounce , this .getData );
234
238
this .$on (' item-click' , item => {
235
239
this .select (item);
236
240
});
You can’t perform that action at this time.
0 commit comments