update Table
This commit is contained in:
parent
297f74ea7f
commit
4098c176e1
6 changed files with 73 additions and 94 deletions
|
@ -1,8 +1,16 @@
|
|||
<template>
|
||||
<div>123</div>
|
||||
<div>{{ row.name }}</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
|
||||
props: {
|
||||
row: Object
|
||||
},
|
||||
mounted () {
|
||||
console.log(1);
|
||||
},
|
||||
beforeDestroy () {
|
||||
console.log(2);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,36 +1,28 @@
|
|||
<template>
|
||||
<Table border :columns="columns7" :data="data6" @on-expand="expand"></Table>
|
||||
<Table border :columns="columns5" :data="data5"></Table>
|
||||
</template>
|
||||
<script>
|
||||
import TableExpand from '../components/tableExpand.vue';
|
||||
import etable from '../components/table.vue';
|
||||
import test from '../components/test.vue';
|
||||
export default {
|
||||
components: { etable },
|
||||
data () {
|
||||
return {
|
||||
columns7: [
|
||||
columns5: [
|
||||
{
|
||||
type: 'expand',
|
||||
width: 50,
|
||||
render: (h, params) => {
|
||||
// return h(etable);
|
||||
// return h('div', params.row.name)
|
||||
return h(TableExpand, { props: { name: params.row.name } })
|
||||
}
|
||||
render: (h) => {
|
||||
return h(etable);
|
||||
},
|
||||
width: 50
|
||||
},
|
||||
{
|
||||
title: '日期',
|
||||
key: 'date',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
key: 'name',
|
||||
render: (h, params) => {
|
||||
return h('div', [
|
||||
h('Icon', {
|
||||
props: {
|
||||
type: 'person'
|
||||
}
|
||||
}),
|
||||
h('strong', params.row.name)
|
||||
]);
|
||||
}
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
|
@ -43,80 +35,43 @@
|
|||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
key: 'name',
|
||||
render: (h, params) => {
|
||||
return h('div', [
|
||||
h('Button', {
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'small'
|
||||
},
|
||||
style: {
|
||||
marginRight: '5px'
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.show(params.index)
|
||||
}
|
||||
}
|
||||
}, '查看'),
|
||||
h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
size: 'small'
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.remove(params.index)
|
||||
}
|
||||
}
|
||||
}, '删除')
|
||||
]);
|
||||
return h(test, {
|
||||
props: {
|
||||
row: params.row
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
data6: [
|
||||
data5: [
|
||||
{
|
||||
name: '王小明',
|
||||
age: 18,
|
||||
address: '北京市朝阳区芍药居'
|
||||
address: '北京市朝阳区芍药居',
|
||||
date: '2016-10-03'
|
||||
},
|
||||
{
|
||||
name: '张小刚',
|
||||
age: 25,
|
||||
address: '北京市海淀区西二旗',
|
||||
_disableExpand: true
|
||||
date: '2016-10-01'
|
||||
},
|
||||
{
|
||||
name: '李小红',
|
||||
age: 30,
|
||||
address: '上海市浦东新区世纪大道',
|
||||
_expanded: true
|
||||
date: '2016-10-02'
|
||||
},
|
||||
{
|
||||
name: '周小伟',
|
||||
age: 26,
|
||||
address: '深圳市南山区深南大道'
|
||||
}
|
||||
address: '深圳市南山区深南大道',
|
||||
date: '2016-10-04'
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show (index) {
|
||||
this.$Modal.info({
|
||||
title: '用户信息',
|
||||
content: `姓名:${this.data6[index].name}<br>年龄:${this.data6[index].age}<br>地址:${this.data6[index].address}`
|
||||
})
|
||||
},
|
||||
remove (index) {
|
||||
this.data6.splice(index, 1);
|
||||
},
|
||||
expand (row, s) {
|
||||
// console.log(row);
|
||||
// console.log(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue