mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs: improve required description (#10025)
This commit is contained in:
parent
e34adc6b09
commit
29b1449977
@ -434,7 +434,7 @@ export default {
|
||||
| Attribute | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| label-width | Field label width | _number \| string_ | `6.2em` |
|
||||
| label-align | Field label align, can be set to `center` `right` | _string_ | `left` |
|
||||
| label-align | Field label align, can be set to `center` `right` | _string_ | `left` |
|
||||
| input-align | Field input align, can be set to `center` `right` | _string_ | `left` |
|
||||
| error-message-align | Error message align, can be set to `center` `right` | _string_ | `left` |
|
||||
| validate-trigger `v2.5.2` | When to validate the form,can be set to `onChange`、`onSubmit` | _string_ | `onBlur` |
|
||||
@ -451,7 +451,7 @@ export default {
|
||||
|
||||
| Key | Description | Type |
|
||||
| --- | --- | --- |
|
||||
| required | Whether to be a required field | _boolean_ |
|
||||
| required | Whether to be a required field, the value is not allowed to be empty string, empty array, `undefined`, `null` | _boolean_ |
|
||||
| message `v2.5.3` | Error message | _string \| (value, rule) => string_ |
|
||||
| validator `v2.5.3` | Custom validator | _(value, rule) => boolean \| Promise_ |
|
||||
| pattern `v2.5.3` | Regex pattern | _RegExp_ |
|
||||
|
@ -478,18 +478,18 @@ export default {
|
||||
|
||||
### Rule 数据结构
|
||||
|
||||
使用 Field 的`rules`属性可以定义校验规则,可选属性如下:
|
||||
使用 Field 的 `rules` 属性可以定义校验规则,可选属性如下:
|
||||
|
||||
| 键名 | 说明 | 类型 |
|
||||
| --- | --- | --- |
|
||||
| required | 是否为必选字段 | _boolean_ |
|
||||
| required | 是否为必选字段,当值为空字符串、空数组、`undefined`、`null` 时,校验不通过 | _boolean_ |
|
||||
| message `v2.5.3` | 错误提示文案 | _string \| (value, rule) => string_ |
|
||||
| validator `v2.5.3` | 通过函数进行校验 | _(value, rule) => boolean \| Promise_ |
|
||||
| pattern `v2.5.3` | 通过正则表达式进行校验 | _RegExp_ |
|
||||
| trigger `v2.5.2` | 本项规则的触发时机,可选值为 `onChange`、`onBlur` | _string_ |
|
||||
| formatter `v2.5.3` | 格式化函数,将表单项的值转换后进行校验 | _(value, rule) => any_ |
|
||||
|
||||
### validate-trigger 可选值
|
||||
### validate-trigger 可选值
|
||||
|
||||
通过 `validate-trigger` 属性可以自定义表单校验的触发时机。
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user