react 生命周期子父件传值

 componentWillReceiveProps(nextProps) {
    const { testValues } = this.props;
    const { pageSize } = this.state;
    if (nextProps.testValues !== testValues) {
      this.getQuery(nextProps.testValues, 1, pageSize);
    }
  }

父调用子组件的方法:可采用生命周期componentWillReceiveProps判断父组件的值是否变化来在子组件中调用子的方法。

posted @ 2020-08-28 23:38  lipu1993  阅读(174)  评论(0编辑  收藏  举报