You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
import React from 'react';
|
|
import { Button, Form, Input, message, Space } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [form] = Form.useForm();
|
|
|
|
const onFinish = () => {
|
|
message.success('Submit success!');
|
|
};
|
|
|
|
const onFinishFailed = () => {
|
|
message.error('Submit failed!');
|
|
};
|
|
|
|
const onFill = () => {
|
|
form.setFieldsValue({
|
|
url: 'https://taobao.com/',
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Form
|
|
form={form}
|
|
layout="vertical"
|
|
onFinish={onFinish}
|
|
onFinishFailed={onFinishFailed}
|
|
autoComplete="off"
|
|
>
|
|
<Form.Item
|
|
name="url"
|
|
label="URL"
|
|
rules={[{ required: true }, { type: 'url', warningOnly: true }, { type: 'string', min: 6 }]}
|
|
>
|
|
<Input placeholder="input placeholder" />
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Space>
|
|
<Button type="primary" htmlType="submit">
|
|
Submit
|
|
</Button>
|
|
<Button htmlType="button" onClick={onFill}>
|
|
Fill
|
|
</Button>
|
|
</Space>
|
|
</Form.Item>
|
|
</Form>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|