将父组件的方法传递给子组件,子组件通过this.props调用传递过来的方法,并带上参数
父组件
1 | import TableSelect from './tableSelect' |
子组件
调用传递过来的getChildValue方法,并传入this,传递的参数带在后面,此时父组件中的childValue会得到该值
1 | <Button type={'link'} onClick={this.props.getChildValue.bind(this, 'aaaaa')}>查询</Button> |