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

View File

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