Commit d322bd7d08962434e12b1bdb9b11be29f75d04bf
Committed by
GitHub
Merge pull request #3663 from SergioCrisostomo/refactor-select
Allow wider search pattern for filterable
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
src/components/select/select.vue
... | ... | @@ -434,11 +434,15 @@ |
434 | 434 | }; |
435 | 435 | }, |
436 | 436 | |
437 | - validateOption({elm, propsData}){ | |
437 | + validateOption({children, elm, propsData}){ | |
438 | 438 | if (this.queryStringMatchesSelectedOption) return true; |
439 | + | |
439 | 440 | const value = propsData.value; |
440 | 441 | const label = propsData.label || ''; |
441 | - const textContent = elm && elm.textContent || ''; | |
442 | + const textContent = (elm && elm.textContent) || (children || []).reduce((str, node) => { | |
443 | + const nodeText = node.elm ? node.elm.textContent : node.text; | |
444 | + return `${str} ${nodeText}`; | |
445 | + }, '') || ''; | |
442 | 446 | const stringValues = JSON.stringify([value, label, textContent]); |
443 | 447 | const query = this.query.toLowerCase().trim(); |
444 | 448 | return stringValues.toLowerCase().includes(query); | ... | ... |