最近要做一个表格,但是为了方便维护,我们需要把表格数据循环出来,方便加减节点:
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column
:prop="item.porp"
:label="item.label"
width="180"
v-for="item in data"
:key="item.key"
></el-table-column>
</el-table>
</template>

<script>
export default {
data() {
return {
data: [
{ label: "编码1日期", porp: "date"},
{ label: "编码2名字", porp: "name"},
{ label: "编码3住址", porp: "address"},
],
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}]
};
}
};
</script>

<style lang="scss" scoped>
</style>