css - 选择中的 A​​ntd 自动换行

我有一个 Select component 和一个 Option children 需要适应给定宽度的所有文本。如果选项文本超过定义的宽度,则应换行。

到目前为止,我正在尝试像下面这样设置 Select 组件的样式,但没有成功:

 <Select style={{ width: 250, height: "auto", wordWrap: "break-word" }} />

下面是我想要实现的链接沙箱

https://codesandbox.io/s/search-with-sort-antd-4-16-13-forked-8fhnt?file=/index.js

是否可以使用 Select 组件进行文本换行?

最佳答案

.ant-select-item-option-content {
  white-space: break-spaces;
  word-break: break-word;
}

在代码沙箱中尝试此处:enter link description here

https://stackoverflow.com/questions/68998571/

相关文章:

r - 有没有办法计算 R 中多个数据帧中每个单元格的标准差?

javascript - 使用键映射和过滤对象数组

python - 为什么 `myfloat in myset` 变得 super 慢?

javascript - 使用 Typescript 接口(interface) - 错误 : pr

r - 根据R中的条件定义元素

python - 如果函数返回 Python 中的模块,要使用什么返回类型注释?

python - 如何将值合并到 discord.py 中的一条消息中

python - 修正 cv2.inRange() 函数的色彩空间

c - 如何在障碍处正确同步线程

html - 如何更改复选框、 slider 、单选按钮和选择组件的强调色