当前位置:网站首页>Fixed height of the first column in El table dynamic header rendering
Fixed height of the first column in El table dynamic header rendering
2022-07-01 05:48:00 【Lonely and arrogant ζ】
Problem effect :

Don't talk much Go straight to the code
Key code :
Add this after getting the data

The overall code :
<el-table
ref="stateStatisticsTable"
:data="tableData"
border
style="width: 100%"
:header-cell-style="{
background: 'rgb(239, 248, 255)',
color: 'rgb(96, 98, 102)',
}"
height="95%"
>
<template v-for="(itemData, indexData) in tableHeader">
<el-table-column
v-if="itemData.prop == 'unit'"
:key="itemData.prop"
:prop="itemData.prop"
:label="itemData.label"
:width="itemData.width ? itemData.width : '200'"
align="center"
fixed // Fix the first column
>
</el-table-column>
<el-table-column
v-if="itemData.prop != 'unit'"
:key="itemData.prop"
:prop="itemData.prop"
:label="itemData.label"
:width="itemData.width"
align="center"
>
<template slot-scope="scope">
<div
style="width: 100%; display: flex; justify-content: center"
v-if="scope.row[itemData.prop] == '1'"
>
<div
style="
width: 12px;
height: 12px;
background-color: #167cc7;
border-radius: 50%;
"
></div>
</div>
<div
style="width: 100%; display: flex; justify-content: center"
v-if="scope.row[itemData.prop] == '2'"
>
<div
style="
width: 12px;
height: 12px;
background-color: #ef871d;
border-radius: 50%;
"
></div>
</div>
</template>
</el-table-column>
</template>
</el-table> this.tableHeader = res.data.data.data[0].tableHeader; // Back end returned header
this.tableData = res.data.data.data[1].tableBody; // data
this.$nextTick(() => {
this.$refs.stateStatisticsTable.doLayout(); // Important code
}); Solution rendering :

边栏推荐
- Wild melon or split melon?
- College community management system based on boot+jsp (with source code download link)
- Diagramme dynamique Excel
- Don't put your notes and videos everywhere!
- CJC8988带2个立体声耳机驱动器的低功率立体声编解码器
- El tooltip in the table realizes line breaking display
- 码蹄集 - MT3114 · 有趣的平衡 - 用样例通俗地讲解
- [medical segmentation] u2net
- Chip, an empire built on sand!
- 运行时候的导包搜索路径虽然pycharm中标红但不影响程序的执行
猜你喜欢

为什么用葫芦儿派盘取代U盘?

Trust guessing numbers game

JDBC common interview questions

It's not that you have a bad mind, but that you haven't found the right tool

基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
SSM的教务管理系统(免费源码获取)

Crossing pie · pie pan + Mountain duck = local data management

Simple implementation of database connection pool

ssm+mysql二手交易网站(论文+源码获取链接)

这才是大学生必备软件 | 知识管理
随机推荐
Don't put your notes and videos everywhere!
基于LabVIEW的计时器
如何添加葫芦儿派盘
Bat operation FTP upload and download command
MySQL数据迁移遇到的一些错误
scope 数据导出mat
不是你脑子不好用,而是因为你没有找到对的工具
Codeforces Round #803 (Div. 2)vp
bat操作ftp上传下载命令
HCM 初学 ( 一 ) - 简介
OpenGL ES: (2) OpenGL ES 与 EGL、GLSL的关系
C语言初阶——牛客网精选好题
表格中el-tooltip 实现换行展示
Through cooperation with the University of international trade, we can increase efficiency for college students
College community management system based on boot+jsp (with source code download link)
Preliminary level of C language -- selected good questions on niuke.com
2022.6.30-----leetcode.1175
Basic electrician knowledge 100 questions
葫芦儿 APP 使用帮助
[medical segmentation] u2net