我有一个 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/