You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provides two common verification methods (1. Click to verify all form elements and submit them; 2. Automatically verify during form input. If all form verification passes the button, you can click Submit)
You can cover all styles
It is support for dynamic forms including objects and arrays
At present, the verification rules are written in elFormItem, and it is not considered to be added to elForm for the time being. Because it already meets the general requirements
If you get an error after downloading npm, it is recommended to copy the src file under the package to your local and use it as your local file (I cannot explain why this is the case for now).
Form field model field, this attribute is required when using validate, resetFields methods
Fields passed into the model of the Form component
Fields passed to the model of the Form component
--
--
label
Label text
string
--
--
N
labelWidth
elFormItem label width
Number
---
--
N
checkOnBlur
Whether to check when losing focus (customInput is true && The input form is a custom input "elFormItem provided by this component")
Boolean
--
--
N
rules
Form validation rules
Array
--
--
Y
elInput
parameter
Description
Type
Optional
default
required
errStyle
Successful textInput style
Object
style of successful TextInput
--
N
succStyle
failure textInput style
Object
style of failure TextInput
--
N
others
Same properties as TextInput
--
--
--
--
elForm Methods
Methods
Description
parameter
validate
Validate all forms
Function(Array或null)
validateField
Validate the specified form
Function(Array或null)
resetField
Reset the form item, reset its value to the initial value, and remove the verification result (because the design of react unidirectional data flow is not easy to implement, it is not provided, you can refer to demo8 to implement, it is not difficult)
--
clearValidate
Remove the verification result of this form item
Warning
warn model not contain key:${xxx}
constructor(props){super(props);this.state={name:"",//requiredphone:""//required}}//...setName(){//Because the required item phone was removed from the state, but Y did not remove the Form.formItem corresponding to phone, which caused the phone to not be removed from the set of validation rules for Form.//If you need to remove a check field, you must remove the corresponding FormItem! !!this.setState({name:"name"})}