Menu.Item 中的 Antd 自动换行 [英] Antd word-wrap in Menu.Item
本文介绍了Menu.Item 中的 Antd 自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在 Menu.Item 组件中应用自动换行?
it is possible to apply word-wrap in a Menu.Item component ?
示例不起作用:https://codepen.io/tiagowippel/pen/LYEKYbb?editable=true&editors=001
<Menu.Item key="1">Option 1Option 1Option 1Option 1Option 1Option 1Option 1Option 1</Menu.Item>
推荐答案
您从 Ant 导入的默认 CSS 设置为截断.您需要更改空白属性:
The default CSS you're importing from Ant is set to truncate. You'll want to change the white-space property:
空白:正常;
然后您可能会注意到换行的文本现在在 y 轴上溢出.您可以更改高度以适应可变高度的内容:
You may then notice that the wrapped text is overflowing in the y axis now. You can change your height to accommodate variable height content:
高度:自动;
这篇关于Menu.Item 中的 Antd 自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文