React JS:如果下面没有空格,React 选择下拉位置到顶部 [英] React JS : React Select Dropdown position to top if there is no space below

查看:68
本文介绍了React JS:如果下面没有空格,React 选择下拉位置到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 React Select

我希望它的下拉位置是动态的.假设它下面没有空格,那么下拉菜单应该打开到上面的选择框.

I want its Dropdown position to be dynamic. let's say if there is no space below it, then the dropdown should be opened to above select box.

<Select
  value={selectedOption}
  onChange={this.handleChange}
  options={options}
/>

是否有任何选项可以使下拉位置动态化?

Is there any option to make dropdown position dynamic?

任何帮助都会很棒.

谢谢.

推荐答案

您可以在带有bottom"的 Select 组件上使用 menuPlacement 选项(默认),顶部"或自动".

You can use menuPlacement option on your Select component with "bottom" (default), "top" or "auto".

您可以在此处查看其他道具;)

You can see other props here ;)

这篇关于React JS:如果下面没有空格,React 选择下拉位置到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆