File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 150
150
151
151
^^^method-submit
152
152
手动提交表单。
153
+
153
154
``` ts
154
155
function submit(): void
155
156
```
156
157
^^^
157
158
158
159
^^^ method - validate
159
160
手动校验表单。
161
+
160
162
` ` ` ts
161
- function validate(fieldNames?: Array<string> | null): Promise<boolean | Record<string, Object>>
163
+ function validate(fieldNames?: Array<string> | null): Promise<true | Record<string, Object>>
162
164
` ` `
165
+
163
166
可选参数 ` fieldNames ` 可以指定进行校验的字段。
164
167
165
- 返回值是 ` Promise ` , 校验成功解析为 ` true ` ,校验失败则解析为 ` Record<string, Object> ` ,其中 key 是错误字段名称。
168
+ 返回值是 ` Promise ` , 校验成功解析为 ` true ` ,校验失败则解析为 ` Record<string, Object> ` ,其中 key 是错误字段名称。
166
169
^^^
167
170
168
171
^^^ method - clearvalidities
169
172
手动清除表单校验信息。
170
173
` ` ` ts
171
174
function clearValidities(fieldNames?: Array<string> | null): void
172
175
` ` `
176
+
173
177
可选参数 ` fieldNames ` 可以指定清除的字段。
174
178
^^^
175
179
176
180
^^^ method - setvalidities
177
181
手动设置表单校验信息。
182
+
178
183
:::warning
179
184
该方法并不能覆盖 ` rules ` 和 ` validators ` 产生的校验信息。
180
185
:::
186
+
181
187
` ` ` ts
182
188
type InputValidity = {
183
189
status: 'success' | 'warning' | 'error'
@@ -193,7 +199,6 @@ this.$refs.form.setValidities({
193
199
` ` `
194
200
^^^
195
201
196
-
197
202
### 表单提交流程
198
203
199
204
< img class = " preview hero" src = " /images/development/form/flow.png" >
Original file line number Diff line number Diff line change @@ -88,7 +88,6 @@ export default {
88
88
]
89
89
}
90
90
},
91
-
92
91
methods: {
93
92
beforeValidate () {
94
93
return new Promise ((resolve ) => {
You can’t perform that action at this time.
0 commit comments