colunmName: ['澳中线-悉尼-仓库', '澳中线-悉尼-仓库1'], totalNumber: 100, data: [{ list: [ { name: '澳中线-悉尼-仓库1', value: 1 }, { name: '澳中线-悉尼-仓库1', value: 1 } ], userName: 'admin' }, { list: [ { name: '澳中线-悉尼-仓库1', value: 1 }, { name: '澳中线-悉尼-仓库1', value: 1 } ], userName: 'jason' }]
以上是数据
然后遍历数据代码
-
<el-table
-
:data=
"data"
-
border
-
>
-
<el-table-column
-
prop=
"userName"
-
:label=
"$t('user.username')"
-
>
-
el-table-column>
-
-
<el-table-column v-for="(item, index) in colunmName" :key="index" :label="item" >
-
-
<template slot-scope="scope">
-
<span>{{scope.row.list[index].value}}
span>
-
template>
-
el-table-column>
-
-
-
el-table-column>
-
<el-table-column
-
prop=
"Total"
-
:label=
"$t('ad.totalNumber')"
-
>
-
el-table-column>
-
el-table>