xinglee23/Blogs

antd table使用记录

Opened this issue · 0 comments

前几天工作上antd Table需要实现鼠标移入显示icon ,鼠标移出icon消失。antd本身row上面有onMouseEnter和onMouseLeave方法,试了但不是自己想要的效果。故在只有在column上做文章,column里的render内加onMouseEnter和onMouseLeave方法,最终效果出现,但是鼠标移入时整列的icon都会出现,移出效果也是整列消失。解决问题的过程中最怕遇到解决一个问题确多了另一个问题,但事已至此问题还是要解决的。解决方法:将每个需要实现该功能的区域加上唯一的key也就是id,鼠标移出或者移入对应唯一的key,此时问题也就达到预期的效果了。

const _id = record.host_id
const show = this.state.id === _id