antd 2.0 的版本table的前面复选框 disabled不生效? table的点击行与点击复选框:2中操作选择row,导致的selectrowkey不一样?

今天开发遇到2个坑:
1.antd 2.0 的版本table的前面复选框 disabled不生效?
踩坑原因:选用的antd版本不对,antd 2.0版本不需要props

getCheckboxProps: (record: any) => ({
   disabled: record.name === 'Disabled User', // Column configuration not to be checked
   name: record.name,
 }),

而antd 1.7 是这样的:

getCheckboxProps: (record: any) => ({
   props:{
  		 disabled: record.name === 'Disabled User', // Column configuration not to be checked
   		 name: record.name,
   }
 }),

2.table的点击行与点击复选框:2中操作选择row,导致的selectrowkey不一样?
bug原因分析:在antd table组件中,我写table属性 row-selection = rowSelection 这个对象里面。
这导致在执行changeRow时,this指向vue实例和我点击行拿到的this:vue实例不同。

const rowSelection = {
      onChange: changeRow
      getCheckboxProps: (record: DataType) => ({
        disabled: record.name === 'Disabled User', 
      }),
    };
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值