下面我有一个我试图实现的链接沙箱 https://code">
我有一个Select组件和一个需要在给定宽度内适应其所有文本的选项。如果选项文本超出了定义的宽度,则应该对其进行换行。
到目前为止,我试图像下面这样设置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组件进行文本换行吗?
发布于 2021-08-31 04:44:43
您需要覆盖样式。
.ant-select-show-search.ant-select:not(.ant-select-customize-input)
.ant-select-selector {
height: auto;
}
.ant-select-single.ant-select-show-arrow .ant-select-selection-item {
white-space: normal;
word-break: break-all;
}
发布于 2021-08-31 04:48:20
.ant-select-item-option-content {
white-space: break-spaces;
word-break: break-word;
}
在代码沙箱中尝试:enter link description here
https://stackoverflow.com/questions/68998571
复制相似问题