这个问题可以通过使用ColumnGroup组件来解决,示例代码如下:
import React from 'react'; import { Table } from 'antd'; const { Column, ColumnGroup } = Table;
const nestedData = [ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park', children: [ { key: '11', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', }, { key: '12', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park', }, ], }, { key: '2', name: 'Jim Red', age: 32, address: 'London No. 2 Lake Park', }, { key: '3', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park', }, ];
const NestedTable = ({ data }) => (
const Example = () => (
export default Example;