2015-08-12 14:57:45 +08:00
|
|
|
# 表单动画进场
|
|
|
|
|
|
|
|
- order: 2
|
|
|
|
|
|
|
|
表单组全合的进场与出场动画。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var EnterAnimation = antd.EnterAnimation;
|
|
|
|
var Select = antd.Select;
|
|
|
|
var Option = Select.Option;
|
|
|
|
var Checkbox = antd.Checkbox;
|
|
|
|
var Radio = antd.Radio;
|
2015-08-24 18:01:41 +08:00
|
|
|
var RadioGroup = antd.Radio.Group;
|
2015-08-12 14:57:45 +08:00
|
|
|
|
|
|
|
var Test = React.createClass({
|
|
|
|
getInitialState(){
|
|
|
|
return {
|
2015-09-07 18:37:07 +08:00
|
|
|
enter:{
|
|
|
|
type:'right',
|
|
|
|
callback:null,
|
|
|
|
interval:0.1
|
|
|
|
},
|
|
|
|
leave:{
|
|
|
|
type:'left',
|
|
|
|
upend:true,
|
|
|
|
interval:0.05,
|
|
|
|
callback:()=>{console.log('出场结束')}
|
|
|
|
},
|
|
|
|
bool:true
|
2015-08-12 14:57:45 +08:00
|
|
|
}
|
|
|
|
},
|
2015-09-07 18:37:07 +08:00
|
|
|
onClick(){
|
2015-08-12 14:57:45 +08:00
|
|
|
this.setState({
|
2015-09-07 18:37:07 +08:00
|
|
|
bool:!this.state.bool
|
2015-08-12 14:57:45 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return (
|
2015-09-07 18:37:07 +08:00
|
|
|
<div>
|
|
|
|
<div style={{marginBottom:20,textAlign:'center'}}>
|
|
|
|
<button className="ant-btn ant-btn-primary" onClick={this.onClick}>切换</button>
|
|
|
|
</div>
|
|
|
|
<EnterAnimation enter={this.state.enter} leave={this.state.leave} component='form' className="ant-form-horizontal">
|
|
|
|
{this.state.bool ? <div key='from'>
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
<label htmlFor="userName" className="col-6" required>用户名:</label>
|
|
|
|
<div className="col-6">
|
|
|
|
<p className="ant-form-text">大眼萌 minion</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="ant-form-item">
|
|
|
|
<label htmlFor="password" className="col-6" required>密码:</label>
|
|
|
|
<div className="col-14">
|
|
|
|
<input className="ant-input" type="password" id="password" placeholder="请输入密码"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
<label className="col-6" required>您的性别:</label>
|
|
|
|
<div className="col-14">
|
|
|
|
<RadioGroup value="male">
|
|
|
|
<Radio value="male">男的</Radio>
|
|
|
|
<Radio value="female">女的</Radio>
|
|
|
|
</RadioGroup>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="ant-form-item">
|
|
|
|
<label htmlFor="remark" className="col-6" required>备注:</label>
|
|
|
|
<div className="col-14">
|
|
|
|
<textarea className="ant-input" id="remark" placeholder="随便写"></textarea>
|
|
|
|
<p className="ant-form-explain">随便写点什么</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="ant-form-item ant-form-item-compact">
|
|
|
|
<div className="col-14 col-offset-6">
|
|
|
|
<label>
|
|
|
|
<Checkbox /> 同意
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="col-16 col-offset-6">
|
|
|
|
<input type="submit" className="ant-btn ant-btn-primary" value="确 定" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div> : null}
|
|
|
|
</EnterAnimation>
|
2015-08-12 14:57:45 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
React.render(<Test />
|
2015-08-24 18:01:41 +08:00
|
|
|
, document.getElementById('components-enter-animation-demo-form'));
|
2015-08-12 14:57:45 +08:00
|
|
|
````
|
|
|
|
|