// 筛选变色
brightenKeyword(val, keyword) {
val = val + '';
if (val.indexOf(keyword) !== -1 && keyword !== '') {
return val.replace(keyword, '<font color="#409EFF">' + keyword + '</font>')
} else {
return val
}
}// 使用方法
<el-table-column label="维护内容"> <template slot-scope="scope"> <span v-html="brightenKeyword(scope.row.strContent, filters.strContent)" ></span> </template> </el-table-column>
开源项目地址: https://github.com/alex-0407/...
相关推荐:
JS的正则replace搜索关键字高亮效果
用JS将搜索的关键字高亮显示实现代码_javascript技巧
Copyright © 2019- obuygou.com 版权所有 赣ICP备2024042798号-5
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务