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.
ant-design-vue/components/vc-form/demo/promise-validate.js

31 lines
628 B

import { createForm } from '../index';
const Form = {
methods: {
handleSubmit(e) {
e.preventDefault();
const { validateFields } = this.form;
validateFields()
.then(console.log)
.catch(console.error);
},
},
render() {
const { getFieldDecorator } = this.form;
return (
<form onSubmit={this.handleSubmit}>
{getFieldDecorator('name', {
rules: [
{
required: true,
},
],
})(<input />)}
<button type="submit">submit</button>
</form>
);
},
};
export default createForm()(Form);