antd3.0 table新增了components属性,用于覆盖默认table元素,官方更新日志上只提供了简答的配置,没有详细的元素使用方式,自己写了个如下,单没有起作用
import React from 'react';
import { Table } from 'antd';
export class TestTable extends React.Component {
constructor() {
super();
this.state = {
components: {
table: MyTable,
header: {
wrapper: HeaderWrapper,
row: HeaderRow,
cell: HeaderCell,
},
body: {
wrapper: BodyWrapper,
row: BodyRow,
cell: BodyCell,
},
},
dataSource:[{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号'
}, {
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号'
}],
columns: [{
title: '姓名',
dataIndex: 'name',
key: 'name',
}, {
title: '年龄',
dataIndex: 'age',
key: 'age',
}, {
title: '住址',
dataIndex: 'address',
key: 'address',
}]
}
}
componentWillMount() {
}
componentWillUnmount() {
}
render() {
const { components, columns, dataSource } = this.state;
return (
);
}
}
const MyTable = () =>
const HeaderWrapper = () =>
const HeaderRow = () =>
const HeaderCell = () =>
const BodyWrapper = () =>
const BodyRow = () =>
const BodyCell = () =>