Explorar el Código

fix: check if searchText is null (#1301)

scil hace 3 años
padre
commit
85a68d5fc3
Se han modificado 1 ficheros con 1 adiciones y 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}`;