el-table鼠标移入变色、el-table排名样式变化

背景颜色实现效果:
在这里插入图片描述

::v-deep .el-table .el-table__body tr td:hover{
  background-color: #d4b021 !important;
}

边框实现效果:

::v-deep .el-table .el-table__body tr td {
  border: 2px solid transparent !important;
}
::v-deep .el-table .el-table__body tr td:hover {
  border: 2px solid red !important;
}

鼠标移入更换整行的背景颜色,实现效果:
在这里插入图片描述

 ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #212e3e !important;
}

二、el-table排名样式变化(前几名有不同背景或不一样的样式。) 

         <el-table-column
                        type="index"
                        label="排名"
                        width="50"
                        style="margin-left:50px;white-space: nowrap;">
                        <template scope="scope" >
							<span class="index_common" :text="scope.$index + 1" :class="[scope.$index + 1 == '1' ? 'index_one' : scope.$index + 1 == '2' ? 'index_two' : scope.$index + 1 == '3' ? 'index_three' : 'index_other']">
								{{ scope.$index + 1 }}
							</span>
						</template>
                    </el-table-column>

//不同样式:
<style>
 .index_one{
        display: inline-block;
        line-height: 40px;
        width: 40px;
        height: 38px;
        background: #E8512E;
        opacity: 0.8;
        font-size: 24px;
        font-family: Myriad Pro;
        color:#ffffff
        // margin-left: -40px;
            }
    .index_two{
        width: 40px;
        height: 38px;
        display: inline-block;
        line-height: 40px;
        background: #FFC000;
        opacity: 0.8;
        font-size: 24px;
        font-family: Myriad Pro;
        color:#ffffff
        // margin-left: -40px;
            }
    .index_three{
        width: 40px;
        height: 38px;
        display: inline-block;
        line-height: 40px;
        background: #00C0FF;
        opacity: 0.8;
        font-size: 24px;
        font-family: Myriad Pro;
        color:#ffffff
        // margin-left: -40px;
            }
</style>

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值