当前位置:网站首页>【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>
写完后的样式如下图,间隔正常了~
边栏推荐
- C language programming topic reference
- Three schemes to improve the efficiency of MySQL deep paging query
- Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
- XILINX/system-controller-c/BoardUI/无法连接开发板,任意操作后卡死的解决办法
- ASP.NET Core入门一
- Read the BGP agreement in 6 minutes.
- Redis —— How To Install Redis And Configuration(如何快速在 Ubuntu18.04 与 CentOS7.6 Linux 系统上安装 Redis)
- unity不识别rider的其中一种解决方法
- 基于STM32+华为云IOT设计的酒驾监控系统
- JVM系列——栈与堆、方法区day1-2
猜你喜欢
HAProxy高可用解决方案
.Net之延迟队列
Understanding and difference between viewbinding and databinding
Go 语言入门很简单:Go 实现凯撒密码
When MDK uses precompiler in header file, ifdef is invalid
Byte interview algorithm question
N++ is not reliable
ViewBinding和DataBinding的理解和区别
三星量产3纳米产品引台媒关注:能否短期提高投入产出率是与台积电竞争关键
Automatic filling of database public fields
随机推荐
C语言中学生成绩管理系统
基于链表管理的单片机轮询程序框架
面试拆解:系统上线后Cpu使用率飙升如何排查?
C语言课程设计题
.Net之延迟队列
E-week finance | Q1 the number of active people in the insurance industry was 86.8867 million, and the licenses of 19 Payment institutions were cancelled
如何在 2022 年为 Web 应用程序选择技术堆栈
MySQL 45 lecture - learn the actual combat notes of MySQL in Geek time 45 lecture - 06 | global lock and table lock_ Why are there so many obstacles in adding a field to the table
Fisher信息量检测对抗样本代码详解
光环效应——谁说头上有光的就算英雄
Interviewer: what is the internal implementation of hash data type in redis?
c#数组补充
忠诚协议是否具有法律效力
The old-fashioned synchronized lock optimization will make it clear to you at once!
Xilinx/system-controller-c/boardui/ unable to connect to the development board, the solution of jamming after arbitrary operation
C language programming topic reference
C#基础补充
Iptables foundation and Samba configuration examples
美国土安全部长:国内暴力极端主义是目前美面临的最大恐怖主义威胁之一
Using scrcpy projection