el-table常用知识点1

实现在一个表格某一行数据的上方浮动一个图片

复制代码
<el-table :data="tableData" border
          height="90%"
          :style="{width: '100%'}"
>
  <el-table-column prop="startDate" label="开始日期" align="center">
    <template slot-scope="scope">
    //判断是否为第一行;暂时使用这个,到时候后端返回一个状态码
      <span v-if="scope.$index == 0">
      //使用position:absolute绝对定位,相对于父级容器显示在居左3px居上3px
        <span style="position: absolute;left: 3px;top: 3px"><img style="height: 40px;width: 40px" src="./img.png"></span>
        <span>{{ scope.row.startDate }}</span>
      </span>
      <span v-else>{{ scope.row.startDate }}</span>
    </template>
  </el-table-column>
  <el-table-column prop="endDate" label="结束日期" align="center"/>
  <el-table-column prop="operatingConditionType" label="工况类型" align="center"/>
</el-table>

有的时候表格会存在没有滚动条的情况

这时候就不要给el-table外面再套一层这个div了,直接使用el-table,然后设置他的宽高

复制代码
<div style="height: 100%">
  <NormalCard title="指标设置" style="position:relative;height:60%;">
    <div style="height: 10%;float: left">
      <el-button @click="edit" type="primary" class="confirmBut" size="mini">编辑</el-button>
      <el-button @click="save" type="primary" style="margin-left: 10px" size="mini">保存</el-button>
      <el-button @click="cancal" type="primary" style="margin-left: 10px" size="mini">取消</el-button>
      <!--          <el-button
                  type="primary"
                  size="mini"
                  @click="$router.replace({ path: '/indicatorWarning' })"
                  style="float: right"
                >返回
                </el-button>-->
      <!--          <div>
                  <el-button
                  type="primary"
                  size="mini"
                  icon="el-icon-download"
                  @click="downloadTableone"
                  style="float: right"
                >下载
                </el-button></div>-->
    </div>
      <el-table id="zbsz" :data="tableData" height="calc(90% - 10px)" style="width: 100%;margin-top: 10px" highlight>
        <el-table-column prop="title" label="指标项" align="center">
          <template slot-scope="{row}">
            <template v-if='row.parameterId=="InjVolume"'>注水量</template>
            <template v-if='row.parameterId=="OilPress"'>油压</template>
相关推荐
顾安r8 分钟前
11.29 脚本游戏 单页面格斗游戏模板
前端·javascript·css·游戏·virtualenv
我叫张小白。14 分钟前
Vue3 路由:单页面应用的核心引擎
前端·javascript·vue.js·前端框架·vue3
天空陪伴星辰a20 分钟前
表单校验问题
前端·javascript·表单校验
鱼鱼块42 分钟前
《最小栈的巧妙设计:用辅助栈实现 O(1) 获取最小值》
javascript·算法·面试
San3043 分钟前
反转字符串与两数之和:两道简单题背后的 JavaScript 思维深度
javascript·算法·面试
拉不动的猪1 小时前
判断dom元素是否在可视区域的常规方式
前端·javascript·面试
Hilaku1 小时前
如何用隐形字符给公司内部文档加盲水印?(抓内鬼神器🤣)
前端·javascript·面试
猫头虎-前端技术1 小时前
小白也能做AI产品?我用 MateChat 给学生做了一个会“拍照解题 + 分步教学”的AI智能老师
前端·javascript·vue.js·前端框架·ecmascript·devui·matechat
栀秋6661 小时前
ES6+新增语法特性:重塑JavaScript的开发范式
前端·javascript
未来之窗软件服务1 小时前
幽冥大陆(三十七)文件系统路径格式化——东方仙盟筑基期
前端·javascript·文件系统·仙盟创梦ide·东方仙盟