【发布时间】:2021-03-07 20:41:34
【问题描述】:
在使用 ant design form 时,我遇到了严重的响应问题。
import { From, Input, Button } from 'antd'
const { Item } = Form;
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
};
const tailLayout = {
wrapperCol: { offset: 8, span: 16 },
};
const ExampleAntForm = () => {
{
return (
<Form {...layout}>
<Item label="Name" name="username"> <Input type="text"/> </Item>
<Item label="Password" name="password"> <Input type="password"/> </Item>
<Item {...tailLayout}>
<Button htmlType="submit" type="primary"> Submit </Button>
</Item>
</Form>
)
}
但在这种情况下,我想根据屏幕大小应用布局。
理想情况如下,
const layout = {
labelCol = { span: { sm: 24, md: 8, lg: 6 }}
wrapperCol = { span: { sm: 24, md: 16, lg: 12 }}
}
如何使用 ant design Form 组件中的 layout 道具来处理这种响应?
Orr 让我知道我的问题的任何其他潜在解决方案。
【问题讨论】:
标签: reactjs layout antd ant-design-pro