فهرست منبع

fix: check if searchText is null (#1301)

scil 3 سال پیش
والد
کامیت
85a68d5fc3
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  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}`;