preface

Antd form 2. JQuery 3. Promise

methods

1. Add ref

this.formRef = React.createRef()
Copy the code

2, check

HandleSubmit = () = > {/ / form checking this. FormRef. Current. Form. The current. ValidateFields (). Then (res = > {/ / success operation let values = { . res } ... }). The catch ((error) = > {the if (error & & error. ErrorFields. Length > 0) {/ / the console. The log (" form check failed!!!!!!!" ); let errorFields = error.errorFields; let startEleId = errorFields[0].name.join("_"); $(`#${startEleId}`).focus(); }})}Copy the code