<template>
<Table border :columns="columns7" :data="data6"></Table>
</template>
<script>
export default {
data () {
return {
columns7: [
{
title: 'Name',
key: 'name'
},
/* additional details...*/
{
title: 'Action',
key: 'action',
width: 150,
align: 'center',
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {//you can attach event handlers here
click: () => {
this.displayInfo(params.index)
}
}
}, 'View'),
h('Button', {
props: {
type: 'error',
size: 'small'
},
on: {
click: () => {
this.deleteEntry(params.index)
}
}
}, 'Delete')
]);
}
}
],
data6: [
{
name: 'John Doe',
age: 22,
address: 'Paris No. 1 Lake Park'
},
{
name: 'Jane Smith',
age: 28,
address: 'Berlin No. 1 Lake Park'
},
{
name: 'Jack White',
age: 35,
address: 'Tokyo No. 1 Lake Park'
},
{
name: 'Jill Brown',
age: 31,
address: 'Chicago No. 2 Lake Park'
}
]
}
},
methods: {
displayInfo (index) {
this.$Modal.info({
title: 'User Details',
content: `Name:${this.data6[index].name}<br>Age:${this.data6[index].age}<br>Address:${this.data6[index].address}`
})
},
deleteEntry (index) {
this.data6.splice(index, 1);
}
}
}
</script>
Columns definition can include a render function for customized display. (You can also link event receivers within the render function).
jsfiddle,iview doc,Vue - render functions