Commit 85a68d5fc392acf6051d4887a762ef1b9bdf85ce

Authored by scil
Committed by GitHub
1 parent a0165d1e

fix: check if searchText is null (#1301)

src/components/Tree/src/Tree.vue
@@ -399,7 +399,7 @@ @@ -399,7 +399,7 @@
399 const children = get(item, childrenField) || []; 399 const children = get(item, childrenField) || [];
400 const title = get(item, titleField); 400 const title = get(item, titleField);
401 401
402 - const searchIdx = title.indexOf(searchText); 402 + const searchIdx = searchText ? title.indexOf(searchText) : -1;
403 const isHighlight = 403 const isHighlight =
404 searchState.startSearch && !isEmpty(searchText) && highlight && searchIdx !== -1; 404 searchState.startSearch && !isEmpty(searchText) && highlight && searchIdx !== -1;
405 const highlightStyle = `color: ${isBoolean(highlight) ? '#f50' : highlight}`; 405 const highlightStyle = `color: ${isBoolean(highlight) ? '#f50' : highlight}`;