Skip to content

Commit f6e6d6c

Browse files
committed
chore: adjust code format
1 parent a190d13 commit f6e6d6c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

one/docs/components/form.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,34 +150,40 @@
150150

151151
^^^method-submit
152152
手动提交表单。
153+
153154
```ts
154155
function submit(): void
155156
```
156157
^^^
157158

158159
^^^method-validate
159160
手动校验表单。
161+
160162
```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>>
162164
```
165+
163166
可选参数 `fieldNames` 可以指定进行校验的字段。
164167

165-
返回值是 `Promise`, 校验成功解析为 `true`,校验失败则解析为 `Record<string, Object>`,其中 key 是错误字段名称。
168+
返回值是 `Promise`校验成功解析为 `true`,校验失败则解析为 `Record<string, Object>`,其中 key 是错误字段名称。
166169
^^^
167170

168171
^^^method-clearvalidities
169172
手动清除表单校验信息。
170173
```ts
171174
function clearValidities(fieldNames?: Array<string> | null): void
172175
```
176+
173177
可选参数 `fieldNames` 可以指定清除的字段。
174178
^^^
175179

176180
^^^method-setvalidities
177181
手动设置表单校验信息。
182+
178183
:::warning
179184
该方法并不能覆盖 `rules``validators` 产生的校验信息。
180185
:::
186+
181187
```ts
182188
type InputValidity = {
183189
status: 'success' | 'warning' | 'error'
@@ -193,7 +199,6 @@ this.$refs.form.setValidities({
193199
```
194200
^^^
195201

196-
197202
### 表单提交流程
198203

199204
<img class="preview hero" src="/images/development/form/flow.png">

one/docs/demo/form/before-after.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export default {
8888
]
8989
}
9090
},
91-
9291
methods: {
9392
beforeValidate () {
9493
return new Promise((resolve) => {

0 commit comments

Comments
 (0)