ant-design-vue/components/vc-table/demo/nested.js

46 lines
794 B
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import Table from '../index';
import '../assets/index.less';
2018-03-27 14:41:41 +00:00
const columns = [
{ title: 'First Name', dataIndex: 'names.first', key: 'a', width: 100 },
{ title: 'Last Name', dataIndex: 'names.last', key: 'b', width: 100 },
{ title: 'Age', dataIndex: 'age', key: 'c', width: 100 },
2019-01-12 03:33:27 +00:00
];
2018-03-27 14:41:41 +00:00
2019-01-12 03:33:27 +00:00
const data = [
{
age: '23',
names: {
first: 'John',
last: 'Doe',
},
key: '1',
2018-03-27 14:41:41 +00:00
},
2019-01-12 03:33:27 +00:00
{
age: '36',
names: {
first: 'Terry',
last: 'Garner',
},
key: '2',
2018-03-27 14:41:41 +00:00
},
2019-01-12 03:33:27 +00:00
{
age: '52',
names: {
first: 'Thomas',
last: 'Goodwin',
},
key: '3',
2018-03-27 14:41:41 +00:00
},
2019-01-12 03:33:27 +00:00
];
2018-03-27 14:41:41 +00:00
export default {
2019-01-12 03:33:27 +00:00
render() {
2018-03-27 14:41:41 +00:00
return (
<div>
<h2>Nested data table</h2>
2019-01-12 03:33:27 +00:00
<Table columns={columns} data={data} class="table" />
2018-03-27 14:41:41 +00:00
</div>
2019-01-12 03:33:27 +00:00
);
2018-03-27 14:41:41 +00:00
},
2019-01-12 03:33:27 +00:00
};