我使用的是antd组件,
compareClickFn(orderCodes, fileNames) {
printLog("orderCodes----------"+ orderCodes);
printLog("fileNames----------"+ fileNames);
this.setState({
show: !this.state.show,
orderCode: orderCodes,
fileName: fileNames,
});
printLog("orderCode and fileName------"+ this.state.show + "----" + this.state.fileName); const ShowAnim = document.getElementById('ShowAnim'); if (this.state.show === false) { ShowAnim.style.display = 'block'; this.state.type = 'primary'; } else { ShowAnim.style.display = 'none'; this.state.type = 'ghost'; } }
这段代码是<Button>组件的onclick事件函数,其中orderCoder和fileName已经获取到了,我想要将这些值保存进入this.state中对应的变量里,但是在触发事件时,出现了第一次点击的时候并没有将数据传递进去,在第二次点击的时候将第一次的数据传递进去了,这个问题该如何解决?
- 2016年11月01日提问
- 评论
- 邀请回答
- 编辑