Browse Source

Merge branch 'dev/v1.0.34_tsz' of jianyu/web into feature/v1.0.34

汤世哲 1 year ago
parent
commit
3150af3358
1 changed files with 6 additions and 4 deletions
  1. 6 4
      apps/mobile/src/ui/project-cell/index.vue

+ 6 - 4
apps/mobile/src/ui/project-cell/index.vue

@@ -303,15 +303,17 @@ export default {
     },
     },
     // 正文开头和高亮词之间,最多保留10个字符
     // 正文开头和高亮词之间,最多保留10个字符
     setDetailText() {
     setDetailText() {
-      let postion = this.detail.indexOf(this.keys[0])
+      // 正则匹配标签置为空
+      const detail = this.detail.replace(/<[^>]+>/g, '')
+      let postion = detail.indexOf(this.keys[0])
       if (postion !== -1) {
       if (postion !== -1) {
         if (postion - 10 > 0) {
         if (postion - 10 > 0) {
-          return this.detail.substring(postion - 10)
+          return detail.substring(postion - 10)
         } else {
         } else {
-          return this.detail
+          return detail
         }
         }
       } else {
       } else {
-        return this.detail
+        return detail
       }
       }
     },
     },
     getTime() {
     getTime() {