vue el-table 动态表头
res: {
code: 200,
data: {
Header: ["姓名", "年龄", "性别出生年月"],
Content: [
["张三", "20", "男"],
["李四", "20", "男"],
["王五", "20", "男"],
["赵六", "20", "男"],
["田七", "20", "男"],
["钱八", "20", "男"],
["孙九", "20", "男"],
["周十", "20", "男"],
]
}
}
<el-table :data="res.data.Content">
<el-table-column v-for="(item, index) in res.data.Header" :key="item" :label="item" show-overflow-tooltip align="center" :min-width="item.length > 7 ? '190' : '110'">
<template slot-scope="scope">
<span>{{res.data.Content.length > 0 ? res.data.Content[scope.$index][index]:''}}</span>
</template>
</el-table-column>
</el-table>
单纯只是记录一下