• Element-UI的使用——表格el-table组件去除边框、滚动条设置、隔行变色、去除鼠标悬停变色效果(基于less)


    1. // Element-ui table表格去掉所有边框,如下:
    2. // 备注:若去掉所有边框,可自行将头部边框注释掉即可
    3. // 该样式写在style scoped外面
    4. 在el-table 中添加class="customer-table"类名
    5. //去掉每行的下边框
    6. /deep/ .el-table td.el-table__cell,/deep/ .el-table th.el-table__cell.is-leaf {
    7. border-bottom: none;
    8. }
    9. // 去掉表格单元格边框
    10. .customer-table th{
    11. border:none;
    12. }
    13. .customer-table td,.customer-table th.is-leaf {
    14. border:none;
    15. }
    16. // 表格最外边框
    17. .el-table--border, .el-table--group{
    18. border: none;
    19. }
    20. // 头部边框
    21. .customer-table thead tr th.is-leaf{
    22. border: 1px solid #EBEEF5;
    23. border-right: none;
    24. }
    25. .customer-table thead tr th:nth-last-of-type(2){
    26. border-right: 1px solid #EBEEF5;
    27. }
    28. // 表格最外层边框-底部边框
    29. .el-table--border::after, .el-table--group::after{
    30. width: 0;
    31. }
    32. .customer-table::before{
    33. width: 0;
    34. }
    35. .customer-table .el-table__fixed-right::before,.el-table__fixed::before{
    36. width: 0;
    37. }
    38. // 表格有滚动时表格头边框
    39. .el-table--border th.gutter:last-of-type {
    40. border: 1px solid #EBEEF5;
    41. border-left: none;
    42. }
    43. // 去除边框线
    44. /deep/ .el-table::before {
    45. height: 0;
    46. }

    修改滚动条的样式,例如设置表格滚动条的颜色、宽度、 背景颜色等:

    1. /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
    2. background-color: #2751be;
    3. border-radius: 6px;
    4. }
    5. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
    6. width: 8px; // 横向滚动条
    7. height: 25px; // 纵向滚动条 必写
    8. background: #12244d;
    9. }
    10. /deep/ .el-table__body-wrapper::-webkit-scrollbar-track {
    11. border-radius: 10px; /*滚动条的背景区域的圆角*/
    12. background-color: rgb(18, 36, 77); /*滚动条的背景颜色*/
    13. }

    隔行变色:

    1. //el-table组件添加属性 :stripe="true"
    2. // 隔行变色(less)
    3. /deep/ .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
    4. background-color: rgba(48, 112, 249, 0.05) !important;
    5. }

    去除鼠标悬停变色效果

    1. //去除鼠标触摸变色效果
    2. /deep/ .el-table tbody tr:hover > td{
    3. background-color: transparent;
    4. }

  • 相关阅读:
    高等数学(第七版)同济大学 习题9-10 个人解答
    kafka连接图形化工具(Offset Explorer和CMAK)
    学习python笔记:5,函数,类
    教你轻松开发一个Andriod版即时通讯
    ptp4l测试-LinuxPTP\ptp4l配置与问题排查
    SLAM从入门到精通(从仿真到实践)
    js中map和set的区别
    「UG/NX」Block UI 指定坐标SpecifyCSYS
    数组力扣485题---最大连续1的个数
    LeetCode二分查找系列(704,34,35,69,367)
  • 原文地址:https://blog.csdn.net/smouns_/article/details/133707907