黄琪勇 3 mesi fa
parent
commit
b794cbd5e0

+ 3 - 3
src/views/components/element/cloudCoachElement/cloudCoachList/cloudCoachList.vue

@@ -111,7 +111,7 @@
                     <img v-if="item.sourceFrom === 'PLATFORM'" class="jxImg" src="./imgs/jx.png" alt="" />
                   </div>
                   <div class="musicInfo">
-                    <EllipsisScroll class="musicTit" :title="item.name || ''" />
+                    <EllipsisScroll class="musicTit" :title="item.highName || ''" />
                     <div class="info">
                       <div class="hotInfo" v-if="item.usedNum">
                         <img src="./imgs/hot.png" alt="" />
@@ -401,7 +401,7 @@ function handleGetQuery() {
     }
     if (res.code === 200) {
       musicList.value = res.data.rows.map((item: any) => {
-        item.name = highlightedText(item.name, queryData.name)
+        item.highName = highlightedText(item.name, queryData.name)
         return item
       })
       queryData.total = res.data.total
@@ -431,7 +431,7 @@ const highlightedText = (text: string, query: string) => {
   if (!query) {
     return text
   }
-  const regex = new RegExp(`(${queryData.name})`, "gi")
+  const regex = new RegExp(`(${query})`, "gi")
   return text.replace(regex, '<span class="highlighted">$1</span>')
 }
 </script>