@@ -54,6 +54,9 @@ const methods = {
5454 const otherField = this .fields [param];
5555 return this .required (field) || (otherField .result && this .required (otherField));
5656 },
57+ async validateFromServer (field , param ) {
58+ return await doServerAPI ();
59+ },
5760};
5861```
5962
@@ -90,10 +93,12 @@ Finally, sets the initialized value:
9093 delay= {100 }
9194/ >
9295
93- // The values like this { email: '', hobby: ['2'] }
94- // classNames and values can be initialized in `BasicForm` use `init`
9596```
9697
98+ * The values like this { email: '', hobby: [ '2'] }
99+ * classNames and values can be initialized in ` BasicForm ` use ` init `
100+ * ` delay ` debounce
101+
97102Validate methods can refer to [ validate-framework-utils] ( https://github.com/MinJieLiu/validate-framework-utils )
98103
99104### Form components
@@ -137,24 +142,25 @@ return (
137142| :--- | :--- | :--- | :--- | :--- |
138143| values | Object | false | | Key-value pairs for ` name ` and` value ` |
139144| classNames | Object | false | {} | Its ` key ` value contains` static ` , ` success ` ,` error ` |
140- | delay | number | false | | delay |
145+ | delay | number | false | | debounce |
141146
142147#### Form params
143148
144- | name | type | default | setState | description |
149+ | name | type | return | setState | description |
145150| :--- | :--- | :--- | :--- | :--- |
146151| fields | Object | | | The collection of fields |
147152| isAllValid | Boolean | | | Gets the global validation status |
148153| formValues | Object | | | Gets a list of form values |
149- | init | function | | false | Initializes the form value and classes |
154+ | init | function | | this | Initializes the form value and classes |
155+ | initClassNames | function | this | false | Initializes classes |
150156| onFormChange | function | | true | Form change event listener |
151- | changeValues | function | | true | Customize to change the values |
152- | validate | function | | true | Validate all fields |
153- | validateByNames | function | | true | Validate the component through names |
154- | addValues | function | | true | Add one or more value |
155- | removeValues | function | | true | Remove one or more value |
156- | addSchemas | function | | false | Add one or more validation rules |
157- | removeSchemas | function | | true | Remove one or more validation rules |
157+ | changeValues | function | this | true | Customize to change the values |
158+ | validate | function | Promise => Boolean | true | Validate all fields |
159+ | validateByNames | function | Promise => Boolean | true | Validate the component through names |
160+ | addValues | function | this | true | Add one or more value |
161+ | removeValues | function | this | true | Remove one or more value |
162+ | addSchemas | function | this | false | Add one or more validation rules |
163+ | removeSchemas | function | Promise => this | true | Remove one or more validation rules |
158164| formDidChange | function | | | Callback |
159165
160166You can either pass in ` values ` as an argument, or call the ` init ` method when the form is initialized.
0 commit comments