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

112 lines
3.2 KiB
Markdown
Raw Normal View History

2015-07-07 11:25:16 +08:00
# 表单组合
2015-07-07 23:45:46 +08:00
- order: 7
2015-07-07 11:25:16 +08:00
2015-07-07 23:45:46 +08:00
集中营,展示和表单相关的其他 ant-design 组件。
2015-07-07 11:25:16 +08:00
---
````jsx
var Select = antd.Select;
var Option = Select.Option;
var InputNumber = antd.InputNumber;
var Datepicker = antd.Datepicker;
2015-07-08 19:47:45 +08:00
var Switch = antd.Switch;
2015-07-09 10:55:37 +08:00
var Menu = antd.Menu;
var Dropdown = antd.Dropdown;
2015-07-15 16:00:59 +08:00
var Slider = antd.Slider;
2015-07-07 11:25:16 +08:00
2015-07-09 10:55:37 +08:00
var menu = <Menu>
<Menu.Item>
<a target="_blank" href="http://www.alipay.com/">.net</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" href="http://www.taobao.com/">.jp</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" href="http://www.tmall.com/">.org</a>
</Menu.Item>
</Menu>;
2015-07-07 11:25:16 +08:00
function handleSelectChange(value) {
console.log('selected ' + value);
}
2015-07-09 10:55:37 +08:00
function onInputNumberChange(v){
2015-07-07 11:25:16 +08:00
console.log('changed',v);
}
React.render(
<form className="ant-form-horizontal">
<div className="ant-form-item">
2015-07-22 17:17:47 +08:00
<label className="col-8" required>InputNumber 数字输入框:</label>
<div className="col-10">
2015-08-10 15:39:50 +08:00
<InputNumber size="large" min={1} max={10} defaultValue={3} onChange={onInputNumberChange} style={{width:100}}/>
<span className="ant-form-text"> 台机器</span>
2015-07-07 11:25:16 +08:00
</div>
</div>
<div className="ant-form-item ant-form-item-compact">
2015-07-22 17:17:47 +08:00
<label className="col-8" required>
<i className="anticon anticon-exclamation-circle" style={{color: '#f60'}}></i> 我是标题:
</label>
<div className="col-10">
<p className="ant-form-text">唧唧复唧唧木兰当户织呀</p>
<p className="ant-form-text">
<a href="javascript:;">链接文字</a>
</p>
2015-07-07 11:25:16 +08:00
</div>
</div>
<div className="ant-form-item">
2015-08-17 13:16:36 +08:00
<label htmlFor="" className="col-8" required>Switch 开关:</label>
<div className="col-10">
<Switch />
2015-07-07 11:25:16 +08:00
</div>
</div>
<div className="ant-form-item">
2015-08-17 13:16:36 +08:00
<label htmlFor="" className="col-8" required>Slider 滑动输入条:</label>
<div className="col-10">
<Slider marks={["A","B","C","D","E","F","G"]} />
2015-07-07 11:25:16 +08:00
</div>
</div>
<div className="ant-form-item">
2015-08-17 13:16:36 +08:00
<label htmlFor="" className="col-8" required>Select 选择器:</label>
2015-07-22 17:17:47 +08:00
<div className="col-16">
2015-08-10 15:39:50 +08:00
<Select size="large" 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>
<div className="ant-form-item">
2015-08-17 13:16:36 +08:00
<label htmlFor="" className="col-8" required>Datepicker 日期选择框:</label>
<div className="col-6">
2015-07-24 16:10:13 +08:00
<Datepicker />
2015-07-07 11:25:16 +08:00
</div>
2015-07-24 16:10:13 +08:00
<div className="col-1">
<p className="ant-form-split">-</p>
2015-07-07 11:25:16 +08:00
</div>
<div className="col-6">
2015-07-24 16:10:13 +08:00
<Datepicker />
2015-07-17 15:12:48 +08:00
</div>
</div>
<div className="ant-form-item has-error">
2015-08-17 13:16:36 +08:00
<label htmlFor="" className="col-8" required>Datepicker 校验:</label>
<div className="col-6">
2015-07-24 16:10:13 +08:00
<Datepicker />
2015-07-07 11:25:16 +08:00
</div>
2015-07-24 16:10:13 +08:00
<div className="col-1">
<p className="ant-form-split">-</p>
</div>
<div className="col-6">
2015-07-24 16:10:13 +08:00
<Datepicker />
</div>
2015-07-22 17:17:47 +08:00
<div className="col-19 col-offset-8">
<p className="ant-form-explain">请输入正确选项</p>
2015-07-07 11:25:16 +08:00
</div>
</div>
</form>
2015-07-07 11:25:16 +08:00
, document.getElementById('components-form-demo-mix'));
2015-07-16 13:00:56 +08:00
````