<template>
<table style="width: 100%; height: 400px; color: red">
<thead style="width: 100%; height: 100px;">
<tr>
<th v-for="header in headers" :key="header.key">
{{ header.label }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in data" :key="row.id">
<td v-for="i in headers" :key="i.key">
{{ row[i.key] }}
</td>
</tr>
</tbody>
</table>
</template>
<script>
export default {
name: 'SimpleTable',
data() {
return {
headers: [
{ key: 'id', label: 'ID' },
{ key: 'name', label: 'Name' },
{ key: 'email', label: 'Email' }
],
data: [
{ id: 1, email: 'jo99999hn@example.com', name: 'John Doe' },
{ id: 2, email: 'jane@example.com', name: 'Jane Doe9999', }
]
}
}
}
</script>
02-08
3万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-09
1308
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交