为了账号安全,请及时绑定邮箱和手机立即绑定

有无了解react全选反选中checked是怎么传值的?求助~

有无了解react全选反选中checked是怎么传值的?求助~

SMILET 2022-01-04 14:10:39
click() {var CheckAll = document.getElementById('All');var CheckBox = document.getElementsByName('box');if (CheckAll.checked == true)for (var i = 0; i < this.props.items.length.length; i++) {CheckBox[i].checked = false;};if (CheckAll.checked == false)for (var i = 0; i < this.props.items.length.length; i++) {CheckBox[i].checked = true;};for (var i = 0; i < this.props.items.length.length; i++) {if (CheckBox[i].checked == true) {CheckBox[i].checked = false;}else {CheckBox[i].checked = true;} };this.setState(this.state.checked = checked );}render(){let items = [];if(this.props.items.length == 0) {items.push(<tr><th colSpan="5" className="tempEmpty">暂无用户</th></tr>);}else {this.props.items.forEach(item => {items.push(<StaffItem key={item.key} item={item} removeStaffItem={this.props.removeStaffItem} detailStaffItem={this.props.detailStaffItem}/>);});}return (<table className='itemPanel'><thead><th> <input type="checkbox" id='all' onChange={this.click.bind(this)} /> </th><th className='itemTd'>姓名</th><th className='itemTd'>年龄</th><th className='itemTd'>身份</th><th className='itemTd'>性别</th><th className='itemTd'>操作</th></thead><tbody>{<td className='itemTd'><input type="checkbox" classname='box' checked={this.state.checked} onChange={this.click.bind(this)}/></td>}</tbody></table>);}}
查看完整描述

1 回答

?
守着星空守着你

TA贡献1799条经验 获得超8个赞

Failed to create directory
CCLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str());
unzClose(zipfile);
return false;
}
}

查看完整回答
反对 回复 2022-01-10
  • 1 回答
  • 0 关注
  • 191 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信