2015-07-07 11:25:16 +08:00
|
|
|
|
# 表单控件
|
2015-06-15 20:24:01 +08:00
|
|
|
|
|
2015-07-21 14:55:22 +08:00
|
|
|
|
- order: 3
|
2015-06-15 20:24:01 +08:00
|
|
|
|
|
|
|
|
|
展示所有支持的表单控件。
|
|
|
|
|
|
2015-06-16 09:54:10 +08:00
|
|
|
|
`注`: 输入框:只有正确设置了 type 属性的输入控件才能被赋予正确的样式。
|
2015-06-15 20:24:01 +08:00
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2015-07-20 20:35:48 +08:00
|
|
|
|
````jsx
|
|
|
|
|
var Select = antd.Select;
|
|
|
|
|
var Option = Select.Option;
|
|
|
|
|
var Checkbox = antd.Checkbox;
|
|
|
|
|
var Radio = antd.Radio;
|
|
|
|
|
var RadioGroup = antd.RadioGroup;
|
|
|
|
|
|
|
|
|
|
function handleSelectChange(value) {
|
|
|
|
|
console.log('selected ' + value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
React.render(
|
|
|
|
|
<form className="ant-form-horizontal">
|
|
|
|
|
<div className="ant-form-item">
|
|
|
|
|
<label className="col-6">输入框:</label>
|
|
|
|
|
<div className="col-14">
|
|
|
|
|
<input type="text" className="ant-input" placeholder="Please enter..." />
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item">
|
|
|
|
|
<label className="col-6">文本域:</label>
|
|
|
|
|
<div className="col-14">
|
|
|
|
|
<textarea className="ant-input"></textarea>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item">
|
|
|
|
|
<label className="col-6">ant-select:</label>
|
|
|
|
|
<div className="col-14">
|
|
|
|
|
<Select value="lucy" style={{width:200}} onChange={handleSelectChange}>
|
|
|
|
|
<Option value="jack">jack</Option>
|
|
|
|
|
<Option value="lucy">lucy</Option>
|
|
|
|
|
<Option value="disabled" disabled>disabled</Option>
|
|
|
|
|
<Option value="yiminghe">yiminghe</Option>
|
|
|
|
|
</Select>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
|
<label className="col-6">ant-checkbox:</label>
|
|
|
|
|
<div className="col-18">
|
|
|
|
|
<label className="ant-checkbox-vertical">
|
|
|
|
|
<Checkbox /> 选项一
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</label>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<label className="ant-checkbox-vertical">
|
|
|
|
|
<Checkbox /> 选项二
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</label>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<label className="ant-checkbox-vertical">
|
|
|
|
|
<Checkbox disabled={true} /> 选项三(不可选)
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
|
<label className="col-6">ant-checkbox:</label>
|
|
|
|
|
<div className="col-18">
|
|
|
|
|
<label className="ant-checkbox-inline">
|
|
|
|
|
<Checkbox />选项一
|
|
|
|
|
</label>
|
|
|
|
|
<label className="ant-checkbox-inline">
|
|
|
|
|
<Checkbox />选项二
|
2015-07-17 15:12:48 +08:00
|
|
|
|
</label>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<label className="ant-checkbox-inline">
|
|
|
|
|
<Checkbox />选项三
|
2015-07-17 15:12:48 +08:00
|
|
|
|
</label>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
|
<label className="col-6">ant-radio:</label>
|
|
|
|
|
<div className="col-18">
|
2015-07-21 16:26:53 +08:00
|
|
|
|
<RadioGroup value={"b"}>
|
|
|
|
|
<Radio value="a">A</Radio>
|
|
|
|
|
<Radio value="b">B</Radio>
|
|
|
|
|
<Radio value="c">C</Radio>
|
|
|
|
|
<Radio value="d">D</Radio>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
</RadioGroup>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
|
<label className="col-6" for="InputFile">头像:</label>
|
|
|
|
|
<div className="col-18">
|
|
|
|
|
<input type="file" id="InputFile" className="ant-upload" />
|
|
|
|
|
<p className="ant-form-explain">请选择一个文件</p>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</div>
|
2015-06-16 09:54:10 +08:00
|
|
|
|
</div>
|
2015-07-07 11:25:16 +08:00
|
|
|
|
</form>
|
2015-07-20 20:35:48 +08:00
|
|
|
|
, document.getElementById('components-form-demo-form-controls'));
|
2015-06-15 20:24:01 +08:00
|
|
|
|
````
|