Bootstrap

js将搜索匹配的字标红

<view v-html="item.ttypeName"></view>
for (var i = 0; i < this.list.length; i++) {
	if (this.list[i]) {
		this.list[i].ttypeName = this.eachColor(
		    this.list[i].ttypeName,
			this.inputs
		);
	}
}

 

eachColor(content, searchVal) {
	let nt = `<span style="color:red">${searchVal}</span>`;
	return content.replace(searchVal, nt);
},

;