项目要求列表需要数据能展开,所以用到antd 的树形数据展示

  • 效果展示

在这里插入图片描述

在这里插入图片描述

  • 部分代码
<Table
	columns={this.columns}
	rowSelection={{ checkStrictly: false,type:radio }}
	dataSource={dataSource}
	rowKey="id"
/>
//checkStrictlyfalse就是选择子级的时候不会把父级一起选中,默认是true
//rowKey表格行 key 的取值,如果不设置可能会选中一个其他的都一起选中
columns = [
        {
            title: '债券',
            dataIndex: 'debenture',
            key: 'debenture'
        },
        {
            title: '债券名称',
            dataIndex: 'debentureName',
            key: 'debentureName',
        },
        {
            title: '简称',
            dataIndex: 'abbreviation',
            key: 'abbreviation'
        }
 ]
const dataSource= [
  {
    debenture: "测试",
    debentureName: 'sds',
    abbreviation: '123',
    children: [
      {
        debenture: 'ceshiziji1',
        debentureName: 'ziji1',
        abbreviation: 'ziji1',
      },
      {
        debenture: 'ceshiziji2',
        debentureName: 'ziji2',
        abbreviation: 'ziji2',
      },
    ],
  },
];
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐