react+ant-deign开发笔记

131 阅读1分钟

1.父组件调用子组件方法

父组件


<NoticeRightView 
    BusinessScene={this.state.BusinessScene} 
    onRef={(ref) => {this.child = ref}}
>
</NoticeRightView>



this.child.getMsgRightItem()

子组件

componentDidMount() {
  this.props.onRef(this)
}