<template>
<el-table
:data="tableData"
style="width: 100%"
:show-header="false"
border
:row-style="rowStyle">
<el-table-column prop="date">
</el-table-column>
<el-table-column prop="name">
</el-table-column>
</el-table>
</template>
<script>
export default {
data() {
return {
dataForm: {
a: 'xxx',
b: 'xxx'
}
}
},
computed: {
//因为数据用到了dataform中的数据,所以写在了computed中
tableData() {
return [{
date: "数据主题",
name: this.dataForm.a
},
{
date: "数据来源",
name: this.dataForm.b
}
]
},
},
methods: {
// 自定义列背景色
rowStyle({
row,
rowIndex,
}) {
if (rowIndex == 0) {
return "background:#f3f6fc;";
} else {
return "background:#ffffff;";
}
}
},
}
</script>
11-22
3013
10-27
786