Element表格关键字高亮
作者:
coderfl | 来源:发表于
2021-11-18 14:34 被阅读0次 <template>
<el-table
:data="tableData"
:height="tableHeight"
border
style="width: 100%">
<template v-for="(item, index) in tableCol">
<el-table-column
:key="index"
:prop="item.prop"
:label="item.label">
<template slot-scope="scope">
<span
v-for="(v, i) in scope.row[item.prop]"
:class="{'keyAct': keyword.indexOf(v) >= 0 && scope.row[item.prop].indexOf(keyword) >= 0}"
:key="i">{{ v }}</span>
</template>
</el-table-column>
</template>
</el-table>
</template>
<script>
data() {
return {
keyword: '',
};
},
methods: {
showKeyword(val) {
this.keyword = val
}
}
</script>
<style scoped>
.keyAct{
color: #00a0e9;
font-weight: bold;
}
</style>
![](https://img.haomeiwen.com/i21345596/74ae97effc653668.png)
image.png
本文标题:Element表格关键字高亮
本文链接:https://www.haomeiwen.com/subject/wmwdtrtx.html
网友评论