1.html
<div
v-html="replaceKeywordColor(item.title)"
></div>
2.js
//value为搜索框内绑定的值
replaceKeywordColor(val) {if (val?.includes(this.value) && this.value !== '') {return val.replace(this.value,'<font color="red">' + this.value + '</font>')} else {return val}},