// str是整段文字,keyWord是需高亮文字
highlightText (str, keyWord) {
const key = '(' + keyWord.replace(/([\+\.\*\|\?\-\(\[\^\$])/g, '\\$1').replace(/\s+/g, '|') + ')'
const pattern = new RegExp(key, 'g')
const str2 = str.replace(pattern, `<span style="color: #f00;">${keyWord}</span>`)
return str2
},