ant-design-vue/components/vc-table/demo/title-and-footer.js

39 lines
1003 B
JavaScript
Raw Normal View History

2018-03-27 14:41:41 +00:00
/* eslint-disable no-console,func-names,react/no-multi-comp */
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 data = [
{ a: '123', key: '1' },
{ a: 'cdd', b: 'edd', key: '2' },
{ a: '1333', c: 'eee', d: 2, key: '3' },
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-04-01 04:52:27 +00:00
const columns = [
{ title: 'title1', dataIndex: 'a', key: 'a', width: 100 },
{ id: '123', title: 'title2', dataIndex: 'b', key: 'b', width: 100 },
{ title: 'title3', dataIndex: 'c', key: 'c', width: 200 },
{
2019-01-12 03:33:27 +00:00
title: 'Operations',
dataIndex: '',
key: 'd',
customRender() {
return <a href="#">Operations</a>;
2018-04-01 04:52:27 +00:00
},
},
2019-01-12 03:33:27 +00:00
];
2018-03-27 14:41:41 +00:00
return (
<div>
<h2>title and footer</h2>
<Table
columns={columns}
data={data}
title={currentData => <div>Title: {currentData.length} items</div>}
footer={currentData => <div>Footer: {currentData.length} items</div>}
/>
</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
};