搜索关键字变色
<template>
<div>
<p v-html="eachColor('有限ddf','有限')"></p>1
</div>
</template>
<script>
export default {
methods: {
eachColor (content, searchVal) {
const nt = '<span style="color:red">' + searchVal + '</span>'
return content.replace(searchVal, nt) + ' '
}
}
}
</script>
<style>
</style>
https://blog.csdn.net/weixin_41542329/article/details/121750082
本文来自博客园,作者:zjxgdq,转载请注明原文链接:https://www.cnblogs.com/zjxzhj/p/16700907.html

浙公网安备 33010602011771号