Vue-cli+Element(table多级表头及遍历表头)
<el-table:data="tableData"height="600"style="width: 100%"><el-table-column :l
·
上代码:
<el-table
:data="tableData"
height //表头固定
style="width: 100%">
<el-table-column :label=title[key] v-for="(item,key) in title" :key="key">
<el-table-column
label="合格"
class-name="normal-color">
<template slot-scope="scope">
{{scope.row[key*2]}}
</template>
</el-table-column>
<el-table-column
prop="name"
label="不合格"
class-name="red-color">
<template slot-scope="scope">
{{scope.row[(key*2+1)]}}
</template>
</el-table-column>
</el-table-column>
</el-table>
export default {
data() {
return {
title:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月"],
tableData:[
name:'1',
list:[3,5,1,2,6,3,4,5,7,8,9,5,4,1,2,3,6,5,4,1]
]
}
},
酱酱~ 成啦~
更多推荐
已为社区贡献4条内容
所有评论(0)