获取子元素的高度

Ale*_*lex 5 html javascript height dynamic reactjs

您好,我将为我的div设置高度。

我尝试通过get window.innerHeight此方法获得整个高度,但我无法访问div的孩子,我也尝试document.getElementById('masonryParent')获得正确的结果,但如何访问div波纹管。有什么建议么?

 this.setState({
      width: window.innerWidth, height: window.innerHeight
    });
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

gue*_*est 7

尝试这个

document.getElementById('masonryParent').children[0].style.height
Run Code Online (Sandbox Code Playgroud)