不能使用(参数A, 参数B)的方式,而是要使用bind
<Button onClick={this.showEdit.bind(this, 'add')}>添加用户</Button>
showEdit = (type) => {
console.log(type) // 这里面的type就是'add'
this.setState({ modalType: type, modalVisible: true })
};
通过 bind(this,参数) 的方法就可以在onClick中传参了