js react 全选和反选
onCheckAll = (data) => {var CheckBox = document.getElementsByName(data);
for(let i=0;i<CheckBox.length;i++){
if(CheckBox[i].checked==true){
CheckBox[i].checked=false;
} else{
CheckBox[i].checked=true
}
};
}
const columnWBS = [
{title:'WBS节点名称',dataIndex:'label'},
{title:'权限',dataIndex:'qx',
render: (text, record, index) =>(
<span >
<Button size="small" onClick={this.onCheckAll.bind(this,record.key)} style={{marginRight:'5px'}}> 全选</Button>
<span >
<input type="checkbox" name={record.key} style={{marginLeft:'5px'}}/> 添加
<input type="checkbox" name={record.key} style={{marginLeft:'5px'}}/> 删除
<input type="checkbox" name={record.key} style={{marginLeft:'5px'}}/> 编辑
<input type="checkbox" name={record.key} style={{marginLeft:'5px'}}/> 查看
</span>
</span>
)}]
以上是 js react 全选和反选 的全部内容, 来源链接: utcz.com/z/384132.html