【发布时间】:2017-08-04 09:38:19
【问题描述】:
我有这样的表列,它的值来自我的减速器。同一列有递增/递减按钮。因此,当使用单击按钮时,我必须从该 <td> 中获取价值并触发我的操作。我正在搜索here,但它用于搜索具有事件onChange 的输入文本。请任何人告诉我如何做到这一点?
这是我的<td> 专栏:
<td>
{this.props.prog}%
<button type="button" className="btn btn-danger">
<span className="glyphicon glyphicon-arrow-up" />
</button>
<button type="button" className="btn btn-danger">
<span className="glyphicon glyphicon-arrow-down" />
</button>
</td>
编辑 1:
我已经尝试了一些基本上我的 onClick 正确触发但我无法传递值
<td>
<button type="button" className="btn btn-danger" onClick={this.props.resetGrowth}>Reset</button>
{this.props.prog}%
<button type="button" className="btn btn-danger" onClick = {(event) => this.props.updated(this.props.prog) }>
<span className="glyphicon glyphicon-arrow-up"/>
</button>
<button type="button" className="btn btn-danger">
<span className="glyphicon glyphicon-arrow-down"/>
</button>
</td>
它会将这个组件传递给它
<Table updated={value => this.props.udated(value)}/>
这是我的容器,它触发了价值
<VolumeComponent
udated = {(value) => updated(value)}/>
const mapDispatchToProps= (dispatch) => (
bindActionCreators({updated},dispatch)
)
【问题讨论】:
标签: javascript html reactjs react-redux