Skip to content

Commit

Permalink
fix: 删除带的多余改动
Browse files Browse the repository at this point in the history
  • Loading branch information
LongHaoo committed Dec 16, 2023
1 parent 70c9cb0 commit 93b9aa6
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions components/form/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,26 +566,6 @@ Form.Item 默认绑定值属性到 `value` 上,而 Switch、Checkbox 等组件
</Form.Item>
```

### 自定义 validator 没有效果

这是由于你的 `validator` 有错误导致 `callback` 没有执行到。你可以选择通过 `async` 返回一个 promise 或者使用 `try...catch` 进行错误捕获:

```jsx
validator: async (rule, value) => {
throw new Error('Something wrong!');
}

// or

validator(rule, value, callback) => {
try {
throw new Error('Something wrong!');
} catch (err) {
callback(err);
}
}
```

### name 为数组时的转换规则?

`name` 为数组时,会按照顺序填充路径。当存在数字且 form store 中没有该字段时会自动转变成数组。因而如果需要数组为 key 时请使用 string 如:`['1', 'name']`
Expand Down

0 comments on commit 93b9aa6

Please sign in to comment.