mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
refactor: Form support namePath
type check (#43904)
* chore: up form * chore: test
This commit is contained in:
parent
b1394ec1a1
commit
8a165947d0
@ -9,6 +9,12 @@ const onFinishFailed = (errorInfo: any) => {
|
||||
console.log('Failed:', errorInfo);
|
||||
};
|
||||
|
||||
type FieldType = {
|
||||
username?: string;
|
||||
password?: string;
|
||||
remember?: string;
|
||||
};
|
||||
|
||||
const App: React.FC = () => (
|
||||
<Form
|
||||
name="basic"
|
||||
@ -20,7 +26,7 @@ const App: React.FC = () => (
|
||||
onFinishFailed={onFinishFailed}
|
||||
autoComplete="off"
|
||||
>
|
||||
<Form.Item
|
||||
<Form.Item<FieldType>
|
||||
label="Username"
|
||||
name="username"
|
||||
rules={[{ required: true, message: 'Please input your username!' }]}
|
||||
@ -28,7 +34,7 @@ const App: React.FC = () => (
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
<Form.Item<FieldType>
|
||||
label="Password"
|
||||
name="password"
|
||||
rules={[{ required: true, message: 'Please input your password!' }]}
|
||||
@ -36,7 +42,11 @@ const App: React.FC = () => (
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="remember" valuePropName="checked" wrapperCol={{ offset: 8, span: 16 }}>
|
||||
<Form.Item<FieldType>
|
||||
name="remember"
|
||||
valuePropName="checked"
|
||||
wrapperCol={{ offset: 8, span: 16 }}
|
||||
>
|
||||
<Checkbox>Remember me</Checkbox>
|
||||
</Form.Item>
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
"rc-dialog": "~9.1.0",
|
||||
"rc-drawer": "~6.2.0",
|
||||
"rc-dropdown": "~4.1.0",
|
||||
"rc-field-form": "~1.35.0",
|
||||
"rc-field-form": "~1.36.0",
|
||||
"rc-image": "~7.1.0",
|
||||
"rc-input": "~1.1.0",
|
||||
"rc-input-number": "~8.0.2",
|
||||
|
Loading…
Reference in New Issue
Block a user