element 表格fixed列高度无法100%

复制代码
下文提到的滚动条皆为横向滚动条

错误方法(旧方法,点击查看旧博客

一下代码虽然能解决fixed列高度无法100%问题,但是会出现fixed列下面的滚动条无法被点击的问题(被fixed列遮挡),所以该方法并不适用

js 复制代码
 .el-table__fixed-right,.el-table__fixed {
    height: calc(100% - 17px) !important; 
    // 默认设置高度,17px为滚动条默认高度,如改变滚动条样式需写入自己改变的滚动条样式高度
  }
  .is-scrolling-none ~ .el-table__fixed-right{ // 无滚动条
    height: 100% !important; // 高度设置为100%
  }
  .is-scrolling-none ~ .el-table__fixed { // 无滚动条
    height: 100% !important; // 高度设置为100%
  }
复制代码
以下两个方法为正确用法,方法二更简单

方法一

将无滚动条时fixed列高度设置为100%,如果有滚动条则设置高度为100%减去滚动条高度

js 复制代码
  .el-table__body-wrapper::-webkit-scrollbar { // 滚动条高度
     height: 17px;
   }
   .el-table__fixed-right,.el-table__fixed { // 有滚动条高度减去17px
     height: calc(100% - 17px) !important;
   }
   .is-scrolling-none ~ .el-table__fixed-right{ // 无滚动条,高度设置为100%
     height: 100% !important;
   }
   .is-scrolling-none ~ .el-table__fixed {
     height: 100% !important;
   }

方法二

将fixed列高度设置为100%,并且将el-table__body-wrapper层级提高(这个方法是最简单直接的方法)

js 复制代码
  .el-table__body-wrapper { // 提高层级
    z-index: 2;
  }
  .el-table__fixed-right,.el-table__fixed { // fixed列高度100%
    height: 100% !important;
  }
相关推荐
摘星编程3 小时前
React Native for OpenHarmony 实战:Linking 链接处理详解
javascript·react native·react.js
胖者是谁3 小时前
EasyPlayerPro的使用方法
前端·javascript·css
EndingCoder4 小时前
索引类型和 keyof 操作符
linux·运维·前端·javascript·ubuntu·typescript
摘星编程4 小时前
React Native for OpenHarmony 实战:ImageBackground 背景图片详解
javascript·react native·react.js
摘星编程5 小时前
React Native for OpenHarmony 实战:Alert 警告提示详解
javascript·react native·react.js
Joe5566 小时前
vue2 + antDesign 下拉框限制只能选择2个
服务器·前端·javascript
WHS-_-20226 小时前
Tx and Rx IQ Imbalance Compensation for JCAS in 5G NR
javascript·算法·5g
摘星编程6 小时前
React Native for OpenHarmony 实战:GestureResponderSystem 手势系统详解
javascript·react native·react.js
lili-felicity6 小时前
React Native for OpenHarmony 实战:加载效果的实现详解
javascript·react native·react.js·harmonyos
济6176 小时前
linux 系统移植(第六期)--Uboot移植(5)--bootcmd 和 bootargs 环境变量-- Ubuntu20.04
java·前端·javascript