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

边栏推荐
- Multi table operation - foreign key cascade operation
- 穿越派 你的数据云行
- boot+jsp的高校社团管理系统(附源码下载链接)
- College community management system based on boot+jsp (with source code download link)
- On the first day of the new year, 3000 Apache servers went down
- 芯片,建立在沙粒上的帝国!
- HDU - 1024 Max Sum Plus Plus(DP)
- Fragment upload and breakpoint resume
- Code shoe set - mt3149 · and - the data is not very strong. Violent pruning can deceive AC
- 【考研高数 武忠祥+880版 自用】高数第二章基础阶段思维导图
猜你喜欢

Basic electrician knowledge 100 questions

Some errors encountered in MySQL data migration

不是你脑子不好用,而是因为你没有找到对的工具

OpenGL ES: (5) OpenGL的基本概念、OpenGL ES 在屏幕产生图片的过程、OpenGL管线(pipeline)

Diagramme dynamique Excel

boot+jsp的高校社團管理系統(附源碼下載鏈接)

Crossing sect · paipan + Siyuan notes = private notebook

FPGA - 7系列 FPGA内部结构之Clocking -01- 时钟架构概述

穿越派·派盘 + 思源笔记 = 私人笔记本

从MLPerf谈起:如何引领AI加速器的下一波浪潮
随机推荐
2022.6.30-----leetcode.1175
表格中el-tooltip 实现换行展示
POL8901 LVDS转MIPI DSI 支持旋转图像处理芯片
A little assistant for teenagers' physiological health knowledge based on wechat applet (free source code + project introduction + operation introduction + operation screenshot + Thesis)
json数据比较器
rust猜数字游戏
Crossing pie · pie pan + Mountain duck = local data management
Looking for high school student developers with similar interests
Why use huluer pie disk instead of U disk?
Educational administration management system (free source code)
idea启动查看项目端口
win10、win11中Elan触摸板滚动方向反转、启动“双指点击打开右键菜单“、“双指滚动“
First defined here occurs during QT compilation. Causes and Solutions
SystemVerilog学习-08-随机约束和线程控制
云盘里资料被和谐了,怎么办?
JSON data comparer
Fragment upload and breakpoint resume
Leetcode Max rectangle, Max square series 84 85. 221. 1277. 1725. (monotonic stack, dynamic programming)
如何添加葫芦儿派盘
穿越派与贸大合作,为大学生增添效率