Commit 85a68d5fc392acf6051d4887a762ef1b9bdf85ce
Committed by
GitHub
1 parent
a0165d1e
fix: check if searchText is null (#1301)
Showing
1 changed file
with
1 additions
and
1 deletions
src/components/Tree/src/Tree.vue
... | ... | @@ -399,7 +399,7 @@ |
399 | 399 | const children = get(item, childrenField) || []; |
400 | 400 | const title = get(item, titleField); |
401 | 401 | |
402 | - const searchIdx = title.indexOf(searchText); | |
402 | + const searchIdx = searchText ? title.indexOf(searchText) : -1; | |
403 | 403 | const isHighlight = |
404 | 404 | searchState.startSearch && !isEmpty(searchText) && highlight && searchIdx !== -1; |
405 | 405 | const highlightStyle = `color: ${isBoolean(highlight) ? '#f50' : highlight}`; | ... | ... |