el-table表格根据后端返回数据自定义表格
【代码】el-table表格根据后端返回数据自定义表格。
·
//html部分 <el-table
border
ref="bookListRef"
//数据渲染
:data="list.datas"
>
<el-table-column
label="序号"
type="index"
align="center"
/>
<el-table-column
//表头渲染
v-for="(tableColumn, ii) in list.title"
:label="tableColumn.columnName"
:key="ii"
:prop="tableColumn.columnField"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
</el-table>
//data数据格式
list: {
datas: [
{
deviceType: 2,
orderDeviceProcessId: 1096,
parentProcessId: 6,
standard: "100%",
taskBatchId: "ac50fcc359db4ad49dcb80457c3250a4",
testTime: "2023-04-06 00:00:00~2023-04-06 14:11:00",
testValue: "5435",
testValueCount: "5435",
truthValue: "5435",
truthValueCount: "5435",
},
],
title: [
{
processId: 81,
id: 1096,
columnField: "standard",
columnName: "正确率",
},
{
processId: 81,
id: 1096,
columnField: "testValueCount",
columnName: "累计被测设备",
},
{
processId: 81,
id: 1096,
columnField: "truthValueCount",
columnName: "累计真值系统",
},
],
},
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)