render: function() {
return<BS.DropdownButton title={this.props.title} style={this.state.buttonStyle}>
<span ref="ddMenu">{this.props.children}</span>
</BS.DropdownButton>
}
在上面的代碼中。我如何確定上述菜單的尺寸?不是按鈕的尺寸,而是點擊按鈕時出現的菜單。我已經嘗試在ddMenu上使用getDOMNode()。getBoundingClientRect()方法使用ref,但尺寸和座標始終爲0.我嘗試在componentDidMount函數中使用此getDOMNode代碼。但是,當按鈕被渲染時運行,而不是菜單。React Bootstrap:獲取下拉菜單寬度
目前我正在使用的菜單正在擴展到窗口之外。我想獲得菜單本身的尺寸,所以我可以調整菜單的樣式以防止它在窗口外面延伸。