Browse Source

feature 1001635

章节搜索结果高亮显示实现
Kevin Jiang 2 years ago
parent
commit
042ffbadb5
1 changed files with 13 additions and 4 deletions
  1. 13 4
      src/views/report/components/reference/ReferenceSearchResultItem.vue

+ 13 - 4
src/views/report/components/reference/ReferenceSearchResultItem.vue

@@ -59,7 +59,7 @@ function onInsertion() {
 
 <template>
   <h3>{{ data.title }}</h3>
-  <h4>{{ data.section }}</h4>
+  <h4 class="section-title" v-html="data.section"></h4>
   <div class="meta">
     <a-space>
       <span v-for="(item, index) in data.unitScholars" :key="index">
@@ -67,9 +67,9 @@ function onInsertion() {
       </span>
     </a-space>
   </div>
-  <div class="content" :class="{'used': used}">
+  <div class="content-wrap" :class="{'used': used}">
     <exclamation-circle-filled v-if="used" />
-    {{ data.content }}
+    <span class="content" v-html="data.content"></span>
   </div>
   <div class="btn-group">
     <a-radio-group>
@@ -82,12 +82,21 @@ function onInsertion() {
 </template>
 
 <style scoped lang="scss">
-.content {
+.section-title {
+  ::v-deep em {
+    color: red;
+  }
+}
+.content-wrap {
   margin-top: 0.5em;
 
   &.used {
     color: #bebebe;
   }
+
+  ::v-deep .content em {
+    color: red;
+  }
 }
 .btn-group {
   margin-top: 0.8em;