el-table点击某一行高亮并显示小圆点的实现代码
更新时间:2022年08月23日 16:59:11 作者:你猜我为啥秃头
这篇文章主要介绍了el-table点击某一行高亮并显示小圆点,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
<el-table
height="93%"
:header-cell-style="{background:'#E5EBF1',color:'#517085'}"
:data="tableData1"
tooltip-effect="dark"
@row-click="clickDetailsFun"
:row-class-name="tableRowClassName"
:row-style="selectedRowStyle"
highlight-current-row //高亮设置
style="width: 100%">
<el-table-column width="30">
<template slot-scope="scope">
<div :id="scope.$index"></div>
</template>
</el-table-column>
<el-table-column
prop="name"
label="电压范围">
</el-table-column>
<el-table-column
prop="value"
label="个数">
</el-table-column>
</el-table>
js部分
tableRowClassName({ row, rowIndex }) {
row.rowIndex = rowIndex;
},
selectedRowStyle({ row, rowIndex }) { //关键代码
if (this.getRowIndex === rowIndex) {
document.getElementById(rowIndex).className = "dis"
}else{
if(document.getElementById(rowIndex)){
document.getElementById(rowIndex).className = "dis2"
}
}
},
clickDetailsFun(val){
this.getRowIndex = val.rowIndex;
}css
//高亮
/deep/.el-table__body tr.current-row>td{
background-color: #d7f3e4 !important;
}
//圆点样式
.dis{
border-radius: 100px;
width:10px;
height:10px;
background:#39C178;
}
.dis2{
display: none;
}效果

到此这篇关于el-table点击某一行高亮并显示小圆点的文章就介绍到这了,更多相关el-table点击高亮显示小圆点内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
vue项目中的public、static及指定不编译文件问题
这篇文章主要介绍了vue项目中的public、static及指定不编译文件问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2023-03-03
解决IE11 vue +webpack 项目中数据更新后页面没有刷新的问题
今天小编就为大家分享一篇解决IE11 vue +webpack 项目中数据更新后页面没有刷新的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2018-09-09
Vue3使用echarts tree高度自适应支持滚动查看功能
这篇文章主要介绍了Vue3使用echarts tree高度自适应支持滚动查看功能,文章同通过代码示例介绍的非常详细,具有一定的参考价值,需要的朋友可以参考下2024-06-06


最新评论