window.getComputedStyle——ref

componentDidMount() {
    const LeftHeight = window.getComputedStyle(this.leftDom).height;
    console.log(LeftHeight);
    setTimeout(function(){
      const LeftHeight = window.getComputedStyle(this.leftDom).height;
      console.log(LeftHeight);
    }.bind(this),1000)
  }


 return (
      <ContentWarp>
        <div className={ left } ref={ dom => { this.leftDom = dom } }>
          <ContentLeft/>
        </div>
        <div className={ right }>
          <ContentRight/>
        </div>
      </ContentWarp>
    )
  }

 

posted @ 2018-01-18 14:02  年少的你如此美丽  阅读(274)  评论(0编辑  收藏  举报