当前位置:   article > 正文

修改table/el-table滚动条_el-table 滚动条

el-table 滚动条

修改el-table 默认滚动条

  1. /* 定义滚动区域的滚动条的样式 */
  2. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  3. width: 14px; /* 设置滚动条的宽度 */
  4. height: 14px;/* 设置滚动条的高度*/
  5. }
  6. /* 定义滚动条滑块的样式 */
  7. /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
  8. border-radius: 0px!important; /* 设置滑块的圆角 */
  9. background-color:#c1c1c1!important; /* 设置滑块的背景色 */
  10. }
  11. /* 定义滚动条轨道的样式 */
  12. /deep/ .el-table__body-wrapper::-webkit-scrollbar-track {
  13. /* box-shadow: inset 0 0 20px rgba(224, 228, 11, 0.9) !important; 设置轨道的阴影效果 */
  14. height: 14px;
  15. background-color:#f1f1f1!important; /* 设置轨道的背景色 */
  16. }
  17. /* 针对Firefox的滚动条样式 */
  18. /deep/ .el-table__body-wrapper {
  19. scrollbar-width: thin !important; /* 设置滚动条宽度 */
  20. scrollbar-color: #c1c1c1 #f1f1f1 !important; /* 设置滑块颜色和轨道颜色 */
  21. }

修改table 默认滚动条

  1. <template>
  2. <div class="tableRow">
  3. <!-- class="table-box" id="table-box" -->
  4. <!-- 操作栏 -->
  5. <div class="tableBtn">
  6. <!-- class="export-box" -->
  7. <btn-search btnTxt="批量审批" @click="spApplyHandker()" />
  8. </div>
  9. <div style="margin:0;width:100%">
  10. <table class="table" style="margin:0;">
  11. <colgroup>
  12. <col name="el-table_1_column_13" width="40">
  13. <col name="el-table_1_column_13" width="50">
  14. <col name="el-table_1_column_13" width="100">
  15. <col name="el-table_1_column_13" width="">
  16. </colgroup>
  17. <thead>
  18. <tr>
  19. <th style="padding-left:15px">
  20. <img v-if="isSltAll" @click="spDataSlt=[],isSltAll=false"
  21. src="../../assets/img/fxk_ygxsmall.png" />
  22. <img v-else @click="trSltHandler('',true,true)" src="../../assets/img/fxk_wgx.png" />
  23. </th>
  24. <th>序号</th>
  25. <th>提交时间</th>
  26. <th>备注</th>
  27. </tr>
  28. </thead>
  29. </table>
  30. </div>
  31. <div style="overflow: auto;
  32. max-height:28rem;
  33. width:100%
  34. ">
  35. <table class="table" style="line-height: 30px;">
  36. <colgroup>
  37. <col name="el-table_1_column_13" width="40">
  38. <col name="el-table_1_column_13" width="50">
  39. <col name="el-table_1_column_13" width="100">
  40. <col name="el-table_1_column_13" width="">
  41. </colgroup>
  42. <tr v-for="(item,key) in dataList" :key="key">
  43. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow ">
  44. <span v-if="item.STATUS == 0">
  45. <span >
  46. <img v-if="spDataSlt.includes(item.ID)" @click="trSltHandler(item,false)"
  47. src="../../assets/img/fxk_ygxsmall.png" />
  48. <img v-else @click="trSltHandler(item,true)" src="../../assets/img/fxk_wgx.png" />
  49. </span>
  50. </span>
  51. </td>
  52. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow " >{{item.num}}</td>
  53. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow ">{{item.UPDATE_TIME}}</td>
  54. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow "
  55. style="max-width: 12rem;overflow: hidden;white-space: normal;min-width:8rem">{{item.REMARK}}
  56. </td>
  57. </tr>
  58. </table>
  59. </div>
  60. <!-- <table class="table">
  61. <thead>
  62. <tr>
  63. <th>
  64. <img v-if="isSltAll" @click="spDataSlt=[],isSltAll=false"
  65. src="../../assets/img/fxk_ygxsmall.png" />
  66. <img v-else @click="trSltHandler('',true,true)" src="../../assets/img/fxk_wgx.png" />
  67. </th>
  68. <th>序号</th>
  69. <th>提交时间</th>
  70. <th>备注</th>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <tr v-for="(item,key) in dataList" :key="key">
  75. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow ">
  76. <span v-if="item.STATUS == 0">
  77. <span >
  78. <img v-if="spDataSlt.includes(item.ID)" @click="trSltHandler(item,false)"
  79. src="../../assets/img/fxk_ygxsmall.png" />
  80. <img v-else @click="trSltHandler(item,true)" src="../../assets/img/fxk_wgx.png" />
  81. </span>
  82. </span>
  83. </td>
  84. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow ">{{item.num}}</td>
  85. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow ">{{item.UPDATE_TIME}}</td>
  86. <td :rowspan="item.APPLY_IDcount" v-if="item.APPLY_IDshow "
  87. style="max-width: 12rem;overflow: hidden;white-space: normal;min-width:8rem">{{item.REMARK}}
  88. </td>
  89. </tr>
  90. </tbody>
  91. </table> -->
  92. <!-- 滚动条 -->
  93. <!-- <scorll-bar ref="scrollRef" id="table-box" /> -->
  94. <!-- 暂无数据 -->
  95. <no-data v-if="!dataList.length" table />
  96. <div class="rows flex-jf-end" style="margin-top: 20px" v-else>
  97. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  98. :current-page="currentPager" :page-sizes="pageSizes" :page-size="pageSize"
  99. layout="total, sizes, prev, pager, next, jumper" :total="totalCount" />
  100. </div>
  101. </div>
  102. </template>
  103. <style scoped lang='less'>
  104. table {
  105. table-layout: fixed; /* 设置表格布局为固定 */
  106. width: 100%; /* 设置表格宽度为100% */
  107. }
  108. table.table tbody tr td {
  109. border: 0.05rem solid #e8e8e8 !important;
  110. /* text-align: center; */
  111. text-overflow: ellipsis;
  112. white-space: nowrap;
  113. overflow: hidden;
  114. }
  115. table.table tr td {
  116. border: 0.05rem solid #e8e8e8 !important;
  117. padding-left:10px;
  118. text-overflow: ellipsis;
  119. white-space: wrap;
  120. overflow: hidden;
  121. }
  122. table.table tr th {
  123. // border: 0.05rem solid #e8e8e8 !important;
  124. padding:0px;
  125. padding-left:10px;
  126. }
  127. table {
  128. width: 99.6%; /* 表格宽度 */
  129. border-collapse: collapse; /* 折叠边框 */
  130. }
  131. /* 为了修改滚动条样式,你需要先隐藏默认的滚动条 */
  132. ::-webkit-scrollbar {
  133. width: 9px; /* 设置滚动条的宽度 */
  134. height: 9px; /* 设置滚动条的高度 */
  135. }
  136. /* 滚动条轨道 */
  137. ::-webkit-scrollbar-track {
  138. background: #ffffff; /* 设置轨道的背景颜色 */
  139. width: 9px;
  140. }
  141. /* 滚动条的滑块 */
  142. ::-webkit-scrollbar-thumb {
  143. background: #e9e9e9; /* 设置滑块的背景颜色 */
  144. border-radius: 20px;
  145. }
  146. /* 当鼠标滑过滑块 */
  147. ::-webkit-scrollbar-thumb:hover {
  148. background: #e9e9e9; /* 设置滑块hover状态的背景颜色 */
  149. }
  150. </style>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/850879
推荐阅读
相关标签
  

闽ICP备14008679号