1.逻辑代码

/**
* 添加用户
*/
import React,{PureComponent} from 'react'
import {Card,Form,Input,Select,Button} from 'antd'
import {connect} from 'react-redux' /**
* 用户列表
*/ const FormItem = Form.Item; const Option = Select.Option; @Form.create()
class UserAdd extends PureComponent{
// 生命周期--组件加载完毕
componentDidMount(){
// this.props.changetitle("用户管理—添加")
} render(){
const { getFieldDecorator } = this.props.form; const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 7 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
md: { span: 10 },
},
}; const submitFormLayout = {
wrapperCol: {
xs: { span: 24, offset: 0 },
sm: { span: 10, offset: 7 },
},
}; return(
<Card bordered={false}>
<Form layout="horizontal">
{/*账号*/}
<FormItem {...formItemLayout} label="账号">
{getFieldDecorator('account', {
rules: [{
required: true, message: '请输入账号',
}],
})(
<Input placeholder="请输入账号" />
)}
</FormItem>
{/*姓名*/}
<FormItem {...formItemLayout} label="姓名">
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入姓名',
}],
})(
<Input placeholder="请输入姓名" />
)}
</FormItem>
{/*状态*/}
<FormItem {...formItemLayout} label="状态">
{getFieldDecorator('state', {
rules: [{
required: true, message: '请选择状态',
}],
initialValue:"0",
})(
<Select >
<Option value="0">禁用</Option>
<Option value="1">启用</Option>
</Select>
)}
</FormItem>
{/*提交|保存按钮*/}
<FormItem {...submitFormLayout} style={{ marginTop: 32 }}>
<Button type="primary" htmlType="submit" >
提交
</Button>
<Button style={{ marginLeft: 8 }}>保存</Button>
</FormItem>
</Form>
</Card>
)
}
} export default connect ((state)=>(
{
state
}
))(UserAdd)

2.效果图

最新文章

  1. currentColor-CSS3非常有用的变量
  2. oracle里面base64加解密
  3. permutation II (boss出来了)
  4. AOP 学习笔记
  5. 无法获取有关Windows NT 组\用户‘组\用户’的信息,错误代码0x5(Microsoft SQL Server,错误:15404)
  6. Linux下编译使用boost库:
  7. 普通用户登录Oracle DB Control
  8. Linux C/C++编译环境搭建
  9. spring 内部工作机制(一)
  10. Java异常处理认识
  11. 机器学习技法:14 Radial Basis Function Network
  12. 第六课 Html5常用标签 html5学习1
  13. BUAA_OO第一单元作业总结
  14. 第57节:Java中流的操作以及编码解码
  15. 查看是否存在tomcat进程和关闭方法
  16. Linux查看GPU使用情况
  17. as3 连接mysql
  18. [RGEOS]数学基础
  19. Think in Java笔记——Java与对象
  20. mybatis 需要注意的点 MyBatis 插入空值时,需要指定JdbcType (201

热门文章

  1. hdu5079
  2. Python timedelta模块 时间增减用法
  3. (转帖)关于easyui中的datagrid在加载数据时候报错:无法获取属性&quot;Length&quot;的值,对象为null或未定义
  4. (转) C#解惑:HashSet&lt;T&gt;类
  5. AtCoder - 2061 Tree Restoring
  6. 【费马小定理】HDU4704-Sum
  7. 微服务之SpringCloud实战(五):SpringCloud Eureka详解
  8. c++基础类型之signed、unsigned的一个细节
  9. 【R笔记】R语言利器之ddply
  10. 将html文档转成pdf