当前位置: 首页 > web >正文

Element中table组件(el-table)右侧滚动条空白占位gutter处理

当我设置了max-height,就会在表格右侧出现一列空白的占位导致表格内容没对齐

<el-table border max-height="56" header-cell-class-name="header_class" stripe size="small"style="width: 100%">
<el-table-column fixed="left" prop="monitorTime" label="监测时间" :formatter="formatDateTime"> </el-table-column><el-table-column fixed="left" label="水质等级"></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">水温<br>℃<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">PH<br>无量纲<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">溶解氧<br>mg/L<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">电导率<br>μS/cm<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">浑浊度<br>NTU<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">高锰酸盐指数<br>mg/L<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">氨氮<br>mg/L<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">总磷<br>mg/L<br></div></template></el-table-column><el-table-column fixed="left"><template slot="header"><div style="line-height: 1.5; text-align: center;">总氮<br>mg/L<br></div></template></el-table-column></el-table>

element的table组件有一个max-height参数可以设置表格组件的最大高度。

如果数据过多,在最大高度内展示不开,就会自动加一个滚动条,进行滚动展示。

如果数据很少,没有达到最大高度,那么右侧不应该有滚动条,和一切干扰列。

但是当我设置了max-height ,且我这个地方没有达到最大高度,就会在表格右侧出现一列空白的占位,这样比较丑。

解决方法1:

不设置max-height参数。

解决方法2:

有特定的需求需要保留max-height参数,调整max-height的高度

<el-table border max-height="60" header-cell-class-name="header_class" stripe size="small"style="width: 100%"></el-table>

解决方法3:

效果图:

使用解决方法2

http://www.xdnf.cn/news/18917.html

相关文章:

  • vue3和react的异同点
  • Tesseract OCR之基线拟合和单词检测
  • 从0开始学习Java+AI知识点总结-26.web实战(Springboot原理)
  • Linux服务器安全配置与NTP时间同步
  • 【Python系列】Flask 和 FastAPI对比
  • 【深度学习新浪潮】SAM 2实战:Meta新一代视频分割模型的实时应用与Python实现
  • Boris FX Samplitude Suite 2025.0.0 音频录制/编辑和母带处理
  • springcloud篇5-微服务保护(Sentinel)
  • 数字IC前端设计——前仿篇(VCS,DVE,Verdi)
  • 企业级集群部署gpmall商城:MyCat+ZooKeeper+Kafka 环境部署与商城应用上线流程
  • Linux SSH 基于密钥交换的自动登录原理简介及配置说明
  • 税务岗位职场能力解析与提升路径规划
  • spring全家桶
  • VMware 中 Ubuntu 右上角网络图标消失的 5 种终极修复方案
  • Android 中使用开源库 ZXing 生成二维码图片
  • Android 播放MP4格式,大视频 几个小时的视频点击快进键视频进度会倒退一秒
  • 基于 Elasticsearch 解决分库分表查询难题
  • MySQL 索引:结构、对比与操作实践指南
  • OpenAI o1:OpenAI最新推出的AI大语言模型,更擅长推理也更贵
  • 使用JDK11标准 实现 图数据结构的增删查改遍历 可视化程序
  • Linux应急响应一般思路(三)
  • Vulkan 学习路线图
  • 【机器学习】(11) --回归树算法
  • 算法题打卡力扣第167题:两数之和——输入有序数组(mid)
  • AMH和cyberpanel等管理软件,哪个里面可以部署AI软件?
  • week4-[二维数组]平面上的点
  • 文件读取结束的判定方法:正确使用feof函数避免文件读取错误
  • 代码随想录算法训练营30天 | ​​01背包理论基础、416. 分割等和子集
  • Pandas 高效数据处理:apply、向量化与分组
  • Android用Coil 3检查媒体资源是否有效,Kotlin