ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

a-table的rowSelection复选框功能无法被选中,单选的时候可以log出来一条但没有显示被选中,全选的时候也只能log出来一条

Open kaichundaily opened this issue 1 year ago • 1 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

undefined

Environment

System:win11,Edge:129.0.2792.52,Vue:^3.4.29

Reproduction link

https://www.bilibili.com/video/BV1yjx7ejEqc/?vd_source=984802e14c2cc93b2077ff505533c83e

Steps to reproduce

如图复现代码:

What is expected?

得到解决方法

What is actually happening?

a-table的rowSelection复选框功能无法被选中,单选的时候可以log出来一条但没有显示被选中,全选的时候也只能log出来一条

kaichundaily avatar Sep 26 '24 15:09 kaichundaily

关于这个问题我已经解决了,官方给的案例并不完全准确,首先你要给你的每条数据加一个key字段,这个官方的例子中是有的,如图是我写的 image 其次selectedRowKeys只拿到了每条数据的key并没有其他内容,你需要加一个selectedRow来接收每条数据的内容,其能拿到你所选中的所有内容 image :row-selection中绑定selectedRowKeys要不然没法看到被选中的效果 image

kaichundaily avatar Sep 27 '24 06:09 kaichundaily

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Nov 27 '24 02:11 github-actions[bot]