https://github.com/wangdahoo/antd-easy-form
https://github.com/wangdahoo/antd-easy-form
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wangdahoo/antd-easy-form
- Owner: wangdahoo
- Created: 2020-04-29T14:00:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T04:35:44.000Z (over 3 years ago)
- Last Synced: 2025-07-14T22:56:51.402Z (11 months ago)
- Language: TypeScript
- Size: 620 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# antd-easy-form
> Easy Form based on Ant Design
## Usage
```jsx
import React, { useState } from 'react'
import { Form, FormItemType } from '@antd-easy-form'
const registerFormItems = [
{
name: 'username',
itemType: FormItemType.INPUT,
labelText: '用户名',
required: true,
re: /^[A-Za-z\d]{4,20}$/
},
{
name: 'password',
itemType: FormItemType.PASSWORD,
labelText: '密码',
defaultValue: '',
required: true,
re: /^[A-Za-z\d_,.?/!@#$%^&*()-=+~|\\]{4,20}$/,
},
{
name: 'password2',
itemType: FormItemType.PASSWORD,
labelText: '再次输入',
placeholder: '请再次输入密码',
defaultValue: '',
required: true,
re: /^[A-Za-z\d_,.?/!@#$%^&*()-=+~|\\]{4,20}$/,
},
{
name: 'gender',
itemType: FormItemType.RADIO,
labelText: '性别',
options: [
{
value: 1,
text: '男'
},
{
value: 0,
text: '女'
},
],
buttonStyle: 'solid'
},
{
name: 'fruits',
itemType: FormItemType.CHECKBOX,
labelText: '喜爱的水果',
options: [
{
value: 'apple',
text: '苹果'
},
{
value: 'orange',
text: '橙子'
},
{
value: 'banana',
text: '香蕉'
},
{
value: 'grape',
text: '葡萄'
},
]
},
{
name: 'memo',
itemType: FormItemType.TEXTAREA,
labelText: '个性签名',
defaultValue: '这个人很懒,什么也没留下'
},
{
name: 'city',
itemType: FormItemType.SELECT,
labelText: '城市',
options: [
{
value: '上海',
text: '上海',
},
{
value: '北京',
text: '北京',
}
]
},
{
name: 'salay',
itemType: FormItemType.NUMBER,
labelText: '收入水平',
unit: '万元',
min: 1,
max: 100,
defaultValue: 10
},
]
export default function App (props) {
return (
)
}
```
### FormItem Reference
[here](https://github.com/wangdahoo/antd-easy-form/blob/master/src/types.ts)
### TODOs
- [x] Custom Form Item