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>
相关推荐
刘发财3 小时前
弃用html2pdf.js,这个html转pdf方案能力是它的几十倍
前端·javascript·github
ssshooter10 小时前
看完就懂 useSyncExternalStore
前端·javascript·react.js
Live0000011 小时前
在鸿蒙中使用 Repeat 渲染嵌套列表,修改内层列表的一个元素,页面不会更新
前端·javascript·react native
柳杉11 小时前
使用Ai从零开发智慧水利态势感知大屏(开源)
前端·javascript·数据可视化
球球pick小樱花11 小时前
游戏官网前端工具库:海内外案例解析
前端·javascript·css
前端Hardy12 小时前
干掉 Virtual DOM?尤雨溪开始"强推" Vapor Mode?
vue.js·vue-router
喝水的长颈鹿12 小时前
【大白话前端 02】网页从解析到绘制的全流程
前端·javascript
用户145369814587812 小时前
VersionCheck.js - 让前端版本更新变得简单优雅
前端·javascript
codingWhat12 小时前
整理「祖传」代码,就是在开发脚手架?
前端·javascript·node.js