广告位联系
返回顶部
分享到

el-table点击某一行高亮并显示小圆点的实现代码

JavaScript 来源:互联网 作者:佚名 发布时间:2022-08-23 19:52:51 人浏览
摘要

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 //高亮设置 sty

<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部分

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

//高亮

/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;

}

效果


版权声明 : 本文内容来源于互联网或用户自行发布贡献,该文观点仅代表原作者本人。本站仅提供信息存储空间服务和不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权, 违法违规的内容, 请发送邮件至2530232025#qq.cn(#换@)举报,一经查实,本站将立刻删除。

您可能感兴趣的文章 :

原文链接 : https://www.cnblogs.com/qq1622397549/p/16616821.html
相关文章
  • 本站所有内容来源于互联网或用户自行发布,本站仅提供信息存储空间服务,不拥有版权,不承担法律责任。如有侵犯您的权益,请您联系站长处理!
  • Copyright © 2017-2022 F11.CN All Rights Reserved. F11站长开发者网 版权所有 | 苏ICP备2022031554号-1 | 51LA统计