فهرست منبع

匹配高亮,配个个数完善。

qinpeng 2 سال پیش
والد
کامیت
1117b89d9f
1فایلهای تغییر یافته به همراه23 افزوده شده و 19 حذف شده
  1. 23 19
      src/views/Textanalysis/index.vue

+ 23 - 19
src/views/Textanalysis/index.vue

@@ -697,19 +697,19 @@ export default {
       // 匹配高亮
       this.ArticelData.forEach((item) => {
         item.forEach((items) => {
-          items.forEach((itemss) => {
-            itemss.text.forEach((itemsss) => {
-              arr.forEach((searchItem, i) => {
-                searchItem.forEach((searchItems) => {
-                  searchItems.forEach((searchItemss) => {
-                    if (itemsss.index == searchItemss) {
-                      itemsss.color = color;
-                    }
-                  });
+          // items.forEach((itemss) => {
+          items.text.forEach((itemsss) => {
+            arr.forEach((searchItem, i) => {
+              searchItem.forEach((searchItems) => {
+                searchItems.forEach((searchItemss) => {
+                  if (itemsss.index == searchItemss) {
+                    itemsss.color = color;
+                  }
                 });
               });
             });
           });
+          // });
         });
       });
       this.$forceUpdate();
@@ -723,23 +723,27 @@ export default {
         });
       });
       this.SearchwordNumber = 0;
-      this.SearchwordNumber = arr[arr.length - 1].length;
+      // 高亮全部
+      arr.forEach((item) => {
+        this.SearchwordNumber += item.length;
+      });
+      // this.SearchwordNumber = arr[arr.length - 1].length; //高亮最后一次
       // 匹配高亮
       this.ArticelData.forEach((item) => {
         item.forEach((items) => {
-          items.forEach((itemss) => {
-            itemss.text.forEach((itemsss) => {
-              arr.forEach((searchItem, i) => {
-                searchItem.forEach((searchItems) => {
-                  searchItems.forEach((searchItemss) => {
-                    if (itemsss.index == searchItemss) {
-                      itemsss.color = this.currentcolorValue[i];
-                    }
-                  });
+          // items.forEach((itemss) => {
+          items.text.forEach((itemsss) => {
+            arr.forEach((searchItem, i) => {
+              searchItem.forEach((searchItems) => {
+                searchItems.forEach((searchItemss) => {
+                  if (itemsss.index == searchItemss) {
+                    itemsss.color = this.currentcolorValue[i];
+                  }
                 });
               });
             });
           });
+          // });
         });
       });
     },