<div>
<el-table ref='mytable' :data='dataList' @select-change='checkAll' @row-click='checkOne'>
<el-table-column v-for='(item,index) in tableHead' :key='index' :prop='item.prop' :label='item.label' />
<el-table-column v-for='(item1,index1) in item.child' :key='index1' :prop='item1.prop' :label='item1.label'/>
<el-table-column v-for='(item2,index2) in item1.child' :key='index2' :prop='item2.prop' :label='item2.label'/>
</el-table-column>
</el-table>
</div>
data(){
return{
tabelHead:[
{label:'id',prop:'id'},
{label:'name',prop:'name'},
{label:'hobby',prop:'hobby',child:[
{label:'hiking',prop:'hiking'},
{label:'swwing',prop:'swwing'},
{label:'music',prop:'music',child:[
{label:'knight',prop:'knight'},
{label:'classical',prop:'classical'},
]},
]},
]
}
}
el-table多级表头for循环渲染
最新推荐文章于 2024-07-26 14:03:04 发布