Ver Fonte

fix: check if searchText is null (#1301)

scil há 3 anos atrás
pai
commit
85a68d5fc3
1 ficheiros alterados com 1 adições e 1 exclusões
  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}`;