如何将自动换行应用于 ANTD 选择标题和下拉项以更改元素的高度?

问题描述 投票:0回答:1

我希望我的 ANTD 标题/所选项目转到下一行并修改 Select 的高度。

我已经研究过这个例子:https://codesandbox.io/s/basic-usage-antd-4-24-7-forked-8jzp29?file=/demo.js

我希望定位的风格是:

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

.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;
}

使用 CSS 模块时如何定位这些内容?

我使用 ANTD Select API

popupClassName="_dropdown"
在下拉列表中添加了一个类,它只接受字符串,但在使用 CSS 模块时会被忽略。

css reactjs antd css-modules
1个回答
0
投票

我就这样实现了内容的换行。

.ant-select-item-option-content {
  white-space: wrap  !important
}
© www.soinside.com 2019 - 2024. All rights reserved.