fix tabel demo bug

This commit is contained in:
Pan 2017-06-30 13:40:18 +08:00
parent 3466b9feb2
commit b15caf637f
2 changed files with 18 additions and 26 deletions

View file

@ -13,7 +13,7 @@
<el-table-column prop="name" label="fruitName" width="180"></el-table-column>
<el-table-column :key='fruit' v-for='(fruit,index) in formThead' :label="fruit">
<template scope="scope">
{{scope.row.list[index].value}}
{{scope.row[fruit]}}
</template>
</el-table-column>
</el-table>
@ -28,20 +28,16 @@
return {
tableData: [
{
name: 'fruit1',
list: [
{ name: 'apple1', value: 10 },
{ name: 'banana1', value: 20 },
{ name: 'orange1', value: 20 }
]
name: 'fruit-1',
apple: 'apple-10',
banana: 'banana-10',
orange: 'orange-10'
},
{
name: 'fruit2',
list: [
{ name: 'apple2', value: 12 },
{ name: 'banana2', value: 22 },
{ name: 'orange2', value: 20 }
]
name: 'fruit-2',
apple: 'apple-20',
banana: 'banana-20',
orange: 'orange-20'
}
],
key: 1, // table key

View file

@ -14,7 +14,7 @@
</el-table-column>
<el-table-column :key='fruit' v-for='(fruit,index) in formThead' :label="fruit">
<template scope="scope">
{{scope.row.list[index].value}}
{{scope.row[fruit]}}
</template>
</el-table-column>
</el-table>
@ -28,20 +28,16 @@
return {
tableData: [
{
name: 'fruit1',
list: [
{ name: 'apple1', value: 10 },
{ name: 'banana1', value: 20 },
{ name: 'orange1', value: 20 }
]
name: 'fruit-1',
apple: 'apple-10',
banana: 'banana-10',
orange: 'orange-10'
},
{
name: 'fruit2',
list: [
{ name: 'apple2', value: 12 },
{ name: 'banana2', value: 22 },
{ name: 'orange2', value: 20 }
]
name: 'fruit-2',
apple: 'apple-20',
banana: 'banana-20',
orange: 'orange-20'
}
],
formThead: ['apple', 'banana']