Python
react 标签描述

第一步在父组件中写下面代码 onRef=(ref)=>{ this.child=ref }; 第二步将此方法传个子组件 <SelectModal onRef={this.onRef} /> 第三步在子组件中实现以下代码 componentDidMount(){ this.props.onRef(this) } 第四步在父组件调用子组件某个函数 //restInfo是我的方法你自己写自己的方法 this.child.restInfo();