Table add content prop to compile custom component
Table add content prop to compile custom component
This commit is contained in:
parent
224a3ae539
commit
d0e206c501
4 changed files with 57 additions and 34 deletions
|
@ -1,27 +1,38 @@
|
|||
<template>
|
||||
<i-table border :columns="columns1" :data="data1"></i-table>
|
||||
<Card>
|
||||
<i-table :content="self" border :columns="columns7" :data="data6"></i-table>
|
||||
</Card>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
columns1: [
|
||||
self: this,
|
||||
columns7: [
|
||||
// {
|
||||
// title: '姓名',
|
||||
// key: 'name',
|
||||
// render (row, column, index) {
|
||||
// return `<strong>${row.name}</strong>`;
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '年龄',
|
||||
// key: 'age'
|
||||
// },
|
||||
// {
|
||||
// title: '地址',
|
||||
// key: 'address'
|
||||
// },
|
||||
{
|
||||
title: '姓名',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
key: 'age',
|
||||
fixed: 'left',
|
||||
// width: 200
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
key: 'address'
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render (row, column, index) {
|
||||
return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`;
|
||||
}
|
||||
}
|
||||
],
|
||||
data1: [
|
||||
data6: [
|
||||
{
|
||||
name: '王小明',
|
||||
age: 18,
|
||||
|
@ -44,6 +55,11 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove (index) {
|
||||
this.data6.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue