【el-table】表格要求内容固定高度,使用原生给计算高度

本文介绍如何在Element UI的el-table组件中实现内容固定高度的效果,通过原生JavaScript来动态计算表格的高度,确保表格在不同数据量下保持理想的展示状态。
摘要由CSDN通过智能技术生成

 

<template>
  <div class="content">
    <div class="content-div-style">
      <searchCom @searchChildFun="searchChildFun" ref="searchChildFun"></searchCom>
      <div class="table-div-project">
        <div class="title">
          <h3>共享资源列表</h3>
          <el-button type="primary" @click="ToNewProject">新增项目</el-button>
        </div>
        <el-table
          :data="tableData"
          style="width: 100%"
          stripe
          class="scrollbar-style"
          :style="{ minHeight: tableHeight + 80 + 'px' }"
          :header-cell-style="{ background: '#FAFAFA' }"
        >
          <template slot="empty">
            <div class="minHeight" :style="{ minHeight: tableHeight + 'px' }">
              <img src="../../assets/no-data.svg" alt="暂无数据" style="margin-top: 15%" />
              <p style="padding: 0; margin: 0; margin-top: -35px; margin-bottom: 20px">暂无数据</p>
            </div>
          </template>
          <el-table-column prop="name" label="培训项目" width="300" show-overflow-tooltip>
          </el-table-column>
          <el-table-column prop="collegeName" label="所属微学院" width="240" show-overflow-tooltip>
          </el-table-column>
          <el-table-column prop="orgName" label="所属部门" width="240" show-overflow-tooltip>
          </el-table-column>
          <el-table-column prop="expense" label="价格" width="120">
            <template slot-scope="scope">
              <span>{
  { toFixed(scope.row.expense) }}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="shareUserName"
            label="发起共享人"
            width="200"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column prop="shareStartTime" label="发起共享时间" width="170">
        
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值