Explorar o código

fix: check if searchText is null (#1301)

scil %!s(int64=3) %!d(string=hai) anos
pai
achega
85a68d5fc3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/components/Tree/src/Tree.vue

+ 1 - 1
src/components/Tree/src/Tree.vue

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