mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
demo: improve types for form basic demo (#47722)
This commit is contained in:
parent
fe837e964c
commit
44b55c6435
@ -1,13 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Button, Checkbox, Form, Input } from 'antd';
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
console.log('Success:', values);
|
||||
};
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
console.log('Failed:', errorInfo);
|
||||
};
|
||||
import { Button, Checkbox, Form, type FormProps, Input } from 'antd';
|
||||
|
||||
type FieldType = {
|
||||
username?: string;
|
||||
@ -15,6 +7,14 @@ type FieldType = {
|
||||
remember?: string;
|
||||
};
|
||||
|
||||
const onFinish: FormProps<FieldType>["onFinish"] = (values) => {
|
||||
console.log('Success:', values);
|
||||
};
|
||||
|
||||
const onFinishFailed: FormProps<FieldType>["onFinishFailed"] = (errorInfo) => {
|
||||
console.log('Failed:', errorInfo);
|
||||
};
|
||||
|
||||
const App: React.FC = () => (
|
||||
<Form
|
||||
name="basic"
|
||||
|
Loading…
Reference in New Issue
Block a user