用的 antd 的组件库 写了一个 select,这里的 onChange 只能拿到 valuefunction StatusCombo(props) { return <Select onChange={props.onChangeStatus} }> </Select>}然后写 columns,在 render 中把上边的 StatusCombo 渲染上去, 这里想给 onChangeStatus 再加上 record.key,因为 后面要用createColumns() { return[{ title: 'status', dataIndex: 'status', render: (text, record) => <StatusCombo onChangeStatus={this.onChangeStatus} ></StatusCombo> }]}最后处理需要 key 和变化的 status,因为 dispath action 时候需要这两个参数onChangeStatus(key, status) { }我应该怎样才能既获得改变的 status 还能获得当前的 key 呢
1 回答
神不在的星期二
TA贡献1963条经验 获得超6个赞
方法1
<button onClick={(ev, arg1, arg2,……) => {this.handleClick(ev, arg1, arg2,……)}}/>
handleClick(ev, arg1, arg,……) {
//code
}
方法2
this.handleclick.bind(this,要传的参数)
// 调用
handleclick(要传的参数,event){
}
方法3
<button onClick={this.handleClick.bind(this, props0, props1, ...}></button>
handleClick(porps0, props1, ..., event) {
// your code here
}
添加回答
举报
0/150
提交
取消