当前位置: 首页 > news >正文

el-table el-table-column表头嵌套循环数据

需求:

不同以前 现在需要表头嵌套循环 以前只要

 <template><el-table:data="tableData"style="width: 100%"><el-table-columnprop="date"label="日期"width="180"></el-table-column></el-table></template>data() {return {tableData: [{date: '2016-05-02',name: '王小虎',address: '上海市普陀区金沙江路 1518 弄'}]}}

现在需要表头嵌套循环:思路,两个数组,一个数组循环表格数据,一个循环表头

<el-tableref="pageTable":data="tableData"style="margin-top: 15px"height="548":header-cell-style="cellStyleFun"id="out-table2"><el-table-columnfixedlabel="管辖单位"prop="C_NAME":formatter="fmtTableProp"align="center"width="230"><template slot-scope="scope"><el-buttontype="text"style="white-space: pre-wrap"@click="detailTree(scope.row)">{{ scope.row.C_NAME }}</el-button></template></el-table-column><el-table-columnv-for="item in tableHeaderData" //单独循环表头-普通循环:key="item":label="item"align="center"width="140"><el-table-columnlabel="登录次数"prop="LOGIN_COUNT"align="center"width="140"><template slot-scope="scope"><span>{{ scope.row[item].LOGIN_COUNT }}</span></template></el-table-column><el-table-columnlabel="检查次数"prop="CHECK_COUNT"align="center"width="140"><template slot-scope="scope"><span>{{ scope.row[item].CHECK_COUNT }}</span></template></el-table-column></el-table-column></el-table>js:
tableHeaderData: [], // 头部列表数据
tableData: [], // 列表数据searchFun() {this.loading = true;const param = this.paramSet();workStatisticsByGx(param).then((data) => {this.loading = false;if (data.data && data.data.code == 10000) {this.tableHeaderData = data.data.otherObj;//表头时间this.tableData = data.data.obj;//表格数据} else {this.$confirm(data.data.message || "服务器忙", "提示", {type: "warning",center: true,customClass: "warn-dialog",}).then(() => {}).catch(() => {});}});},


http://www.mrgr.cn/news/19616.html

相关文章:

  • LLaMA-Factory仓基础功能架构及NPU/GPU环境实战演练
  • MySQL进阶篇3 -- 视图、存储过程、触发器
  • 海康二次开发笔记10-独立Group导入、导出及执行
  • 【MySQL】Ubuntu22.04安装MySQL8.0.39及修改默认用户名和密码
  • 等保待优化处理集合
  • while和for的区别和break、continue的用法
  • 3D打印模型库
  • python学习14:如何读取yaml文件?
  • 隐式类型转换/匿名对象的使用以及构造拷贝构造的优化
  • Kafka【八】如何保证消息发送的可靠性、重复性、有序性
  • 什么是Selenium?使用Selenium进行自动化测试
  • 工欲善其事,必先利其器——推荐一款适合程序员专业编程显示屏
  • Mac(M2)系统手动安装ADB
  • 23. Redis数据结构(二)
  • 此项不起作用,请确保你的蓝牙设备仍可检测到
  • 体验通义灵码 @workspace:轻松分析项目结构,结合代码仓库理解工程、查询问答等
  • 如何把文件夹里的所有文件每个建立一个文件夹,并且以文件的名字命名
  • LeetCode 热题100-72 每日温度
  • 【C++ Primer Plus习题】10.8
  • 我的大模型岗位面试总结!太卷了!!!—我面试了24家大模型岗位 只拿了9个offer!