• el-table 表格表头、单元格、滚动条样式修改


    .2023.11.21今天我学习了如何对el-table表格样式进行修改,如图:

    运用的两个样式主要是

    1.header-cell-class-name(设置表头)

    2.class-name(设置行单元格)

    代码如下:

    1. <el-table :data="typeList"
    2. class="real_operation_table"
    3. :header-cell-class-name="'header_name_style'">
    4. <el-table-column :class-name="'all_cell_style'" align="center" v-for="(value, key) in typeList[0]" :key="key"
    5. :prop="key">
    6. <template slot="header" slot-scope="scope">
    7. <span>{{ value.name }}span>
    8. template>
    9. <template slot-scope="scope">
    10. <span>{{ scope.row[key].value }}span>
    11. template>
    12. el-table-column>
    13. el-table>

    .el-table如果有class记得换成自己的类名 ,没有就直接用el-table

    1. //添加表头表格颜色
    2. ::v-deep .header_name_style {
    3. background-color: rgb(4, 62, 114) !important;
    4. color: #4cd0ee;
    5. font-size: 20px;
    6. }
    7. //添加单元格背景颜色
    8. ::v-deep .all_cell_style {
    9. background-color: rgb(5, 35, 61);
    10. color: #4cd0ee;
    11. font-size: 20px;
    12. }
    13. //去掉表格底部边框
    14. .real_operation_table::before {
    15. width: 0;
    16. }
    17. //去掉单元格边框
    18. ::v-deep .real_operation_table .el-table__cell {
    19. border: none !important;
    20. }
    21. ::v-deep .el-table--scrollable-y .el-table__body-wrapper {
    22. background-color: rgb(5, 35, 61);
    23. }
    24. ::v-deep .real_operation_table .el-table__cell.gutter {
    25. background-color: rgb(6, 71, 128) !important;
    26. }
    27. //鼠标移入效果
    28. ::v-deep.real_operation_table {
    29. // 每行鼠标经过得样式
    30. .el-table__body tr:hover > td {
    31. background-color: rgb(5, 35, 61) !important;
    32. }
    33. .el-table__body tr.current-row > td {
    34. background-color: rgb(5, 35, 61) !important;
    35. }
    36. }
    37. // 滚动条样式
    38. ::v-deep ::-webkit-scrollbar {
    39. width: 0.4vh;
    40. }
    41. ::v-deep ::-webkit-scrollbar-track {
    42. background-color: transparent;
    43. }
    44. ::v-deep ::-webkit-scrollbar-thumb {
    45. background-color: rgb(68, 148, 220);
    46. border-radius: 4px;
    47. }
    48. //去掉表格背景颜色
    49. ::v-deep .el-table {
    50. background-color: transparent !important;
    51. }

  • 相关阅读:
    elasticsearch 6.3.2 集群配置
    strcat()用法
    网络安全复习笔记
    Java框架 SpringMVC--完全注解配置
    1.1 git常规操作
    虚拟摄像头之二: 配置v4l2loopback虚拟摄像头为前置或后置摄像头
    第一章 基础算法(三)
    Allegro如何输出EMN文件操作指导
    深入ftrace function原理
    从基础知识到应用实例,一站式掌握 Python 正则表达式
  • 原文地址:https://blog.csdn.net/qq_53986004/article/details/134523608