|
@@ -303,15 +303,17 @@ export default {
|
|
|
},
|
|
|
// 正文开头和高亮词之间,最多保留10个字符
|
|
|
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 - 10 > 0) {
|
|
|
- return this.detail.substring(postion - 10)
|
|
|
+ return detail.substring(postion - 10)
|
|
|
} else {
|
|
|
- return this.detail
|
|
|
+ return detail
|
|
|
}
|
|
|
} else {
|
|
|
- return this.detail
|
|
|
+ return detail
|
|
|
}
|
|
|
},
|
|
|
getTime() {
|