当前位置:网站首页>【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>
写完后的样式如下图,间隔正常了~
边栏推荐
- Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
- 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
- Dgraph: large scale dynamic graph dataset
- 结合案例:Flink框架中的最底层API(ProcessFunction)用法
- 字节面试算法题
- C语言程序设计
- C language programming topic reference
- [cloud native | kubernetes] in depth understanding of ingress (12)
- Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
- OpenHarmony应用开发之如何创建DAYU200预览器
猜你喜欢
[cloud native | kubernetes] in depth understanding of ingress (12)
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Oracle 被 Ventana Research 评为数字创新奖总冠军
Getting started with the go language is simple: go implements the Caesar password
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 06 | 全局锁和表锁_给表加个字段怎么有这么多阻碍
分布式BASE理论
面试拆解:系统上线后Cpu使用率飙升如何排查?
The only core indicator of high-quality software architecture
Dgraph: large scale dynamic graph dataset
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
随机推荐
Commvault 和 Oracle 合作,在 Oracle 云上提供 Metallic数据管理即服务
CTF competition problem solution STM32 reverse introduction
基于STM32+华为云IOT设计的酒驾监控系统
Openharmony application development how to create dayu200 previewer
Dgraph: large scale dynamic graph dataset
SCM polling program framework based on linked list management
美国土安全部部长警告移民“不要踏上危险的旅程”
One of the solutions for unity not recognizing riders
C#基础深入学习二
C语言个人通讯录管理系统
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
Web知识补充
Using scrcpy projection
2022kdd pre lecture | 11 first-class scholars take you to unlock excellent papers in advance
提高MySQL深分页查询效率的三种方案
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
C language programming topic reference
SQL语言
Flet tutorial 03 basic introduction to filledbutton (tutorial includes source code) (tutorial includes source code)
2022KDD预讲 | 11位一作学者带你提前解锁优秀论文