ant-design/components/form/demo/disabled.md

51 lines
1.2 KiB
Markdown
Raw Normal View History

2015-07-07 11:25:16 +08:00
# 禁用状态
2015-06-15 20:24:01 +08:00
2015-10-29 08:41:51 +08:00
- order: 7
2015-06-15 20:24:01 +08:00
2015-10-25 11:35:03 +08:00
1) 单独为输入控件设置 `disabled` 属性;
2015-07-07 11:25:16 +08:00
2) 为 `<fieldset>` 设置 `disabled` 属性,可以禁用 `<fieldset>` 中包含的所有控件。
2015-06-15 20:24:01 +08:00
---
2015-10-09 15:44:10 +08:00
````jsx
import { Row, Col, Button, Input, Form } from 'antd';
2015-10-29 08:41:51 +08:00
const FormItem = Form.Item;
2015-10-09 15:44:10 +08:00
2015-10-25 11:35:03 +08:00
ReactDOM.render(
2015-10-29 08:41:51 +08:00
<Form horizontal>
<FormItem
label="单独禁用输入框:"
labelCol={{ span: 5 }}
wrapperCol={{ span: 12 }}>
2015-10-29 08:41:51 +08:00
<Input defaultValue="我是禁用的" disabled />
</FormItem>
2015-07-08 15:41:19 +08:00
2015-10-29 08:41:51 +08:00
<fieldset disabled>
<legend>禁用的 fieldset</legend>
<FormItem
id="userName"
label="用户名:"
labelCol={{ span: 5 }}
wrapperCol={{ span: 12 }}
2015-11-25 17:47:55 +08:00
required>
2015-10-29 08:41:51 +08:00
<p className="ant-form-text">大眼萌 minion</p>
</FormItem>
<FormItem
id="password"
label="密码:"
labelCol={{ span: 5 }}
wrapperCol={{ span: 12 }}
2015-11-25 17:47:55 +08:00
required>
2015-10-29 08:41:51 +08:00
<Input type="password" defaultValue="123456" id="password" />
</FormItem>
<Row>
<Col span="12" offset="5">
<Button htmlType="submit" type="primary">确定</Button>
</Col>
</Row>
</fieldset>
</Form>
, mountNode);
2015-06-15 20:24:01 +08:00
````