


想要的需求:点击+号,显示子表格的数据
<a-table
:dataSource="dataSource"
:columns="columns"
:pagination="pagination"
@change="tableChange"
rowKey="id"
@expand="expandChange"
>
绑定expand,参数有两个,expanded, record
const expandChange = (expanded:any, record:any) => {
console.log(expanded, record.id, '得到的数据');
当expanded为真实,调用子表格的数据
if(!expanded) return
rentEnterpriseList(record.id)
}
本文介绍了如何在React中使用`<a-table>`组件实现表格的展开功能,当用户点击展开时,通过`expandChange`钩子获取记录ID,并动态调用`rentEnterpriseList`方法加载子表格的数据。
4448

被折叠的 条评论
为什么被折叠?



