当前位置:网站首页>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 :

边栏推荐
- HDU - 1069 Monkey and Banana(DP+LIS)
- idea启动查看项目端口
- Crossing pie · pie pan + Mountain duck = local data management
- SystemVerilog学习-06-类的封装
- 穿越派与贸大合作,为大学生增添效率
- Ssgssrcsr differences
- 教务管理系统(免费源码获取)
- In win10 and win11, the scroll direction of Elan touch panel is reversed, and "double finger click to open the right-click menu" and "double finger scroll" are started“
- Codeforces Round #803 (Div. 2)vp
- 基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
猜你喜欢

Primary application case of Excel DuPont analyzer

What is the at instruction set often used in the development of IOT devices?

Why use huluer pie disk instead of U disk?

Don't put your notes and videos everywhere!

LeetCode 最大矩形,最大正方形系列 84. 85. 221. 1277. 1725. (单调栈,动态规划)

【QT】qt加减乘除之后,保留小数点后两位

excel初级应用案例——杜邦分析仪

MySQL converts milliseconds to time string

Ssm+mysql second-hand trading website (thesis + source code access link)

A little assistant for teenagers' physiological health knowledge based on wechat applet (free source code + project introduction + operation introduction + operation screenshot + Thesis)
随机推荐
Bat operation FTP upload and download command
libpng12.so.0: cannot open shared object file: No such file or directory 亲测有效
Excel dynamic chart
Beauty of Mathematics - Application of Mathematics
[medical segmentation] u2net
excel初级应用案例——杜邦分析仪
Don't put your notes and videos everywhere!
POL8901 LVDS转MIPI DSI 支持旋转图像处理芯片
boot+jsp的高校社團管理系統(附源碼下載鏈接)
【QT】qt加减乘除之后,保留小数点后两位
JDBC common interview questions
【笔记】电商订单数据分析实战
Code shoe set - mt3114 · interesting balance - explain it with examples
Simple implementation of database connection pool
OneFlow源码解析:算子签名的自动推断
2022.6.30-----leetcode.1175
我从技术到产品经理的几点体会
excel可视化
CentOS 7 installed php7.0 using Yum or up2date
mysql 将毫秒数转为时间字符串