import React from 'react'; import { Input, Form, Button, Select } from '@alifd/next'; const FormItem = Form.Item; const formItemLayout = { colSpan: 12, }; const ROLES = [{ label: '管理员', value: 'admin', }, { label: '开发', value: 'dev', }, { label: '测试', value: 'test', }]; export interface IDataSource { name?: string; nick?: string; role?: string; } export interface IBasicFormProps { defaultValue?: IDataSource; onSubmit?: (value) => void; onCancel?: () => void; } const BasicForm: React.SFC = (props): JSX.Element => { const { defaultValue = {}, onSubmit = () => {}, onCancel = () => {}, } = props; // const [postData, setValue] = useState(dataSource); // const formChange = (values: BasicFormProps): void => { // setValue(values); // }; const { name, nick, role } = defaultValue; const handleSubmit = (value, errors) => { if (!errors) { onSubmit(value); } } return (