当前位置:网站首页>【Antd踩坑】Antd Form 配合Input.Group时出现Form.Item所占据的高度不对
【Antd踩坑】Antd Form 配合Input.Group时出现Form.Item所占据的高度不对
2022-07-04 12:48:00 【似酒龙井】
Antd Form 配合Input.Group时出现Form.Item所占据的高度不对,间隔会偏大,如下图红框
看了下代码,可能是因为Input.Group导致有额外的margin-bottom
</Form.Item>
<Form.Item label="Y主轴取值范围">
<Input.Group compact>
<Form.Item name="YMainAxisRangeMin">
<Input
addonBefore=""
style={
{
width: 100, textAlign: 'center' }}
placeholder="Minimum"
/>
</Form.Item>
<Input
className="site-input-split"
style={
{
width: 30,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Form.Item name="YMainAxisRangeMax">
<Input
className="site-input-right"
style={
{
width: 100,
textAlign: 'center',
}}
placeholder="Maximum"
/>
</Form.Item>
</Input.Group>
</Form.Item>
<Form.Item label="Y主轴步长" name="YMainAxisStep">
<Input
style={
{
width: 100, textAlign: 'center' }}
placeholder="Y主轴步长"
/>
</Form.Item>
想了个解决方法:在Form.Item外再嵌套一个div并限制其高度,即可解决「我知道治标不治本,求求不喜勿喷」
</Form.Item>
<div style={
{
height: '56px' }}>
<Form.Item label="Y主轴取值范围">
<Input.Group compact>
<Form.Item name="YMainAxisRangeMin">
<Input
addonBefore=""
style={
{
width: 100, textAlign: 'center' }}
placeholder="Minimum"
/>
</Form.Item>
<Input
className="site-input-split"
style={
{
width: 30,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Form.Item name="YMainAxisRangeMax">
<Input
className="site-input-right"
style={
{
width: 100,
textAlign: 'center',
}}
placeholder="Maximum"
/>
</Form.Item>
</Input.Group>
</Form.Item>
</div>
<Form.Item label="Y主轴步长" name="YMainAxisStep">
<Input
style={
{
width: 100, textAlign: 'center' }}
placeholder="Y主轴步长"
/>
</Form.Item>
写完后的样式如下图,间隔正常了~
边栏推荐
- Introduction to XML III
- 担心“断气” 德国正修改《能源安全法》
- Automatic filling of database public fields
- C language programming topic reference
- FS7867S是一款应用于数字系统供电电源电压监控的电压检测芯片
- 美国土安全部部长警告移民“不要踏上危险的旅程”
- 结合案例:Flink框架中的最底层API(ProcessFunction)用法
- Five "potential errors" in embedded programming
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- WS2811 M是三通道LED驱动控制专用电路彩灯带方案开发
猜你喜欢
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
Interviewer: what is the internal implementation of hash data type in redis?
Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
Install Trinity and solve error reporting
【R语言数据科学】:交叉验证再回首
CA: efficient coordinate attention mechanism for mobile terminals | CVPR 2021
基于STM32+华为云IOT设计的酒驾监控系统
Flet tutorial 03 basic introduction to filledbutton (tutorial includes source code) (tutorial includes source code)
提高MySQL深分页查询效率的三种方案
2022年起重机械指挥考试模拟100题模拟考试平台操作
随机推荐
Animation and transition effects
上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!
2022年起重机械指挥考试模拟100题模拟考试平台操作
C语言程序设计选题参考
How to choose a technology stack for web applications in 2022
基于STM32+华为云IOT设计的酒驾监控系统
Haproxy high availability solution
C language Dormitory Management Query Software
C#基础深入学习一
Optional values and functions of the itemized contenttype parameter in the request header
Xilinx/system-controller-c/boardui/ unable to connect to the development board, the solution of jamming after arbitrary operation
Automatic filling of database public fields
[AI system frontier dynamics, issue 40] Hinton: my deep learning career and research mind method; Google refutes rumors and gives up tensorflow; The apotheosis framework is officially open source
Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
.NET 使用 redis
Fs4056 800mA charging IC domestic fast charging power IC
一次 Keepalived 高可用的事故,让我重学了一遍它
2022kdd pre lecture | 11 first-class scholars take you to unlock excellent papers in advance
Using scrcpy projection
数据库公共字段自动填充