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

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-03-25 14:23:04 +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-25 14:23:04 +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-25 14:23:04 +00:00
export default {
2019-01-12 03:33:27 +00:00
render() {
2018-03-25 14:23:04 +00:00
const columns = [
2019-01-12 03:33:27 +00:00
{ title: 'title1', dataIndex: 'a', class: 'a', key: 'a', width: 100 },
{ id: '123', title: 'title2', dataIndex: 'b', className: 'b', key: 'b', width: 100 },
{ title: 'title3', dataIndex: 'c', className: 'c', key: 'c', width: 200 },
2018-03-25 14:23:04 +00:00
{
2019-01-12 03:33:27 +00:00
title: 'Operations',
dataIndex: '',
2018-03-25 14:23:04 +00:00
className: 'd',
2019-01-12 03:33:27 +00:00
key: 'd',
customRender: () => {
return <a href="#">Operations</a>;
2018-03-25 14:23:04 +00:00
},
},
2019-01-12 03:33:27 +00:00
];
2018-03-25 14:23:04 +00:00
return (
<div>
<h2>rowClassName and className</h2>
<Table
columns={columns}
rowClassName={(record, i) => `row-${i}`}
expandedRowRender={record => <p>extra: {record.a}</p>}
expandedRowClassName={(record, i) => `ex-row-${i}`}
data={data}
2019-01-12 03:33:27 +00:00
class="table"
2018-03-25 14:23:04 +00:00
/>
</div>
2019-01-12 03:33:27 +00:00
);
2018-03-25 14:23:04 +00:00
},
2019-01-12 03:33:27 +00:00
};