Commit bc348e7ebfcf63d89f3e8ef5cf1d24b44cf3b5f3
1 parent
ae7579e9
adapt to auto-complete
Showing
1 changed file
with
7 additions
and
5 deletions
Show diff stats
src/components/select/select.vue
... | ... | @@ -250,16 +250,16 @@ |
250 | 250 | }, |
251 | 251 | dropVisible () { |
252 | 252 | let status = true; |
253 | - const options = this.selectOptions; | |
254 | - if (!this.loading && this.remote && this.query === '' && !options.length) status = false; | |
253 | + const noOptions = !this.selectOptions || this.selectOptions.length === 0; | |
254 | + if (!this.loading && this.remote && this.query === '' && noOptions) status = false; | |
255 | 255 | |
256 | - if (this.autoComplete && !options.length) status = false; | |
256 | + if (this.autoComplete && noOptions) status = false; | |
257 | 257 | |
258 | 258 | return this.visible && status; |
259 | 259 | }, |
260 | 260 | showNotFoundLabel () { |
261 | 261 | const {loading, remote, selectOptions} = this; |
262 | - return selectOptions.length === 0 && (!remote || (remote && !loading)); | |
262 | + return selectOptions && selectOptions.length === 0 && (!remote || (remote && !loading)); | |
263 | 263 | }, |
264 | 264 | publicValue(){ |
265 | 265 | if (this.labelInValue){ |
... | ... | @@ -278,6 +278,8 @@ |
278 | 278 | let optionCounter = -1; |
279 | 279 | const currentIndex = this.focusIndex; |
280 | 280 | const selectedValues = this.values.map(({value}) => value); |
281 | + if (this.autoComplete) return this.slotOptions; | |
282 | + | |
281 | 283 | for (let option of (this.slotOptions || [])) { |
282 | 284 | |
283 | 285 | const cOptions = option.componentOptions; |
... | ... | @@ -618,7 +620,7 @@ |
618 | 620 | this.hasExpectedValue = false; |
619 | 621 | } |
620 | 622 | |
621 | - if (options.length === 0){ | |
623 | + if (options && options.length === 0){ | |
622 | 624 | this.query = ''; |
623 | 625 | } |
624 | 626 | } | ... | ... |