From a31f78b07a93adda18bf6d7499cd1262d9844d53 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 23 Jul 2022 18:36:00 +0800 Subject: [PATCH] docs: improve description of name and required props (#10841) * docs: improve description of name and required props * docs: fix --- packages/vant/src/checkbox/README.md | 2 +- packages/vant/src/checkbox/README.zh-CN.md | 22 ++++++++++---------- packages/vant/src/form/README.md | 2 +- packages/vant/src/form/README.zh-CN.md | 2 +- packages/vant/src/radio/README.md | 2 +- packages/vant/src/radio/README.zh-CN.md | 18 ++++++++-------- packages/vant/src/stepper/README.md | 2 +- packages/vant/src/stepper/README.zh-CN.md | 2 +- packages/vant/src/swipe-cell/README.md | 2 +- packages/vant/src/swipe-cell/README.zh-CN.md | 2 +- packages/vant/src/uploader/README.md | 2 +- packages/vant/src/uploader/README.zh-CN.md | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/vant/src/checkbox/README.md b/packages/vant/src/checkbox/README.md index 8911b6e10..2589a630c 100644 --- a/packages/vant/src/checkbox/README.md +++ b/packages/vant/src/checkbox/README.md @@ -250,7 +250,7 @@ export default { | Attribute | Description | Type | Default | | --- | --- | --- | --- | | v-model | Check status | _boolean_ | `false` | -| name | Checkbox name | _any_ | - | +| name | Checkbox name, usually a unique string or number | _any_ | - | | shape | Can be set to `square` | _string_ | `round` | | disabled | Disable checkbox | _boolean_ | `false` | | label-disabled | Whether to disable label click | _boolean_ | `false` | diff --git a/packages/vant/src/checkbox/README.zh-CN.md b/packages/vant/src/checkbox/README.zh-CN.md index 3282ee347..1c7f74ffd 100644 --- a/packages/vant/src/checkbox/README.zh-CN.md +++ b/packages/vant/src/checkbox/README.zh-CN.md @@ -265,17 +265,17 @@ export default { ### Checkbox Props -| 参数 | 说明 | 类型 | 默认值 | -| -------------- | ------------------------- | ------------------ | --------- | -| v-model | 是否为选中状态 | _boolean_ | `false` | -| name | 标识符 | _any_ | - | -| shape | 形状,可选值为 `square` | _string_ | `round` | -| disabled | 是否禁用复选框 | _boolean_ | `false` | -| label-disabled | 是否禁用复选框文本点击 | _boolean_ | `false` | -| label-position | 文本位置,可选值为 `left` | _string_ | `right` | -| icon-size | 图标大小,默认单位为 `px` | _number \| string_ | `20px` | -| checked-color | 选中状态颜色 | _string_ | `#1989fa` | -| bind-group | 是否与复选框组绑定 | _boolean_ | `true` | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| v-model | 是否为选中状态 | _boolean_ | `false` | +| name | 标识符,通常为一个唯一的字符串或数字 | _any_ | - | +| shape | 形状,可选值为 `square` | _string_ | `round` | +| disabled | 是否禁用复选框 | _boolean_ | `false` | +| label-disabled | 是否禁用复选框文本点击 | _boolean_ | `false` | +| label-position | 文本位置,可选值为 `left` | _string_ | `right` | +| icon-size | 图标大小,默认单位为 `px` | _number \| string_ | `20px` | +| checked-color | 选中状态颜色 | _string_ | `#1989fa` | +| bind-group | 是否与复选框组绑定 | _boolean_ | `true` | ### CheckboxGroup Props diff --git a/packages/vant/src/form/README.md b/packages/vant/src/form/README.md index 9e17c3068..be371c514 100644 --- a/packages/vant/src/form/README.md +++ b/packages/vant/src/form/README.md @@ -511,7 +511,7 @@ export default { | Key | Description | Type | | --- | --- | --- | -| required | Whether to be a required field, the value is not allowed to be empty string, empty array, `undefined`, `null` | _boolean_ | +| required | Whether to be a required field, the value is not allowed to be empty string, empty array, `false`, `undefined`, `null` | _boolean_ | | message | Error message | _string \| (value, rule) => string_ | | validator | Custom validator | _(value, rule) => boolean \| string \| Promise_ | | pattern | Regex pattern | _RegExp_ | diff --git a/packages/vant/src/form/README.zh-CN.md b/packages/vant/src/form/README.zh-CN.md index 51c6e5a7f..dac3ced29 100644 --- a/packages/vant/src/form/README.zh-CN.md +++ b/packages/vant/src/form/README.zh-CN.md @@ -547,7 +547,7 @@ export default { | 键名 | 说明 | 类型 | | --- | --- | --- | -| required | 是否为必选字段,当值为空字符串、空数组、`undefined`、`null` 时,校验不通过 | _boolean_ | +| required | 是否为必选字段,当值为空字符串、空数组、`false`、`undefined`、`null` 时,校验不通过 | _boolean_ | | message | 错误提示文案 | _string \| (value, rule) => string_ | | validator | 通过函数进行校验 | _(value, rule) => boolean \| string \| Promise_ | | pattern | 通过正则表达式进行校验 | _RegExp_ | diff --git a/packages/vant/src/radio/README.md b/packages/vant/src/radio/README.md index f309e588f..45f6cbd1a 100644 --- a/packages/vant/src/radio/README.md +++ b/packages/vant/src/radio/README.md @@ -178,7 +178,7 @@ import type { | Attribute | Description | Type | Default | | --- | --- | --- | --- | -| name | Radio name | _any_ | - | +| name | Radio name, usually a unique string or number | _any_ | - | | shape | Can be set to `square` | _string_ | `round` | | disabled | Whether to disable radio | _boolean_ | `false` | | label-disabled | Whether to disable label click | _boolean_ | `false` | diff --git a/packages/vant/src/radio/README.zh-CN.md b/packages/vant/src/radio/README.zh-CN.md index eb0aba4ee..5dd316959 100644 --- a/packages/vant/src/radio/README.zh-CN.md +++ b/packages/vant/src/radio/README.zh-CN.md @@ -176,15 +176,15 @@ export default { ### Radio Props -| 参数 | 说明 | 类型 | 默认值 | -| -------------- | ------------------------- | ------------------ | --------- | -| name | 标识符 | _any_ | - | -| shape | 形状,可选值为 `square` | _string_ | `round` | -| disabled | 是否为禁用状态 | _boolean_ | `false` | -| label-disabled | 是否禁用文本内容点击 | _boolean_ | `false` | -| label-position | 文本位置,可选值为 `left` | _string_ | `right` | -| icon-size | 图标大小,默认单位为 `px` | _number \| string_ | `20px` | -| checked-color | 选中状态颜色 | _string_ | `#1989fa` | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| name | 标识符,通常为一个唯一的字符串或数字 | _any_ | - | +| shape | 形状,可选值为 `square` | _string_ | `round` | +| disabled | 是否为禁用状态 | _boolean_ | `false` | +| label-disabled | 是否禁用文本内容点击 | _boolean_ | `false` | +| label-position | 文本位置,可选值为 `left` | _string_ | `right` | +| icon-size | 图标大小,默认单位为 `px` | _number \| string_ | `20px` | +| checked-color | 选中状态颜色 | _string_ | `#1989fa` | ### RadioGroup Props diff --git a/packages/vant/src/stepper/README.md b/packages/vant/src/stepper/README.md index 54b4732e4..e672cd403 100644 --- a/packages/vant/src/stepper/README.md +++ b/packages/vant/src/stepper/README.md @@ -128,7 +128,7 @@ export default { | max | Max value | _number \| string_ | - | | default-value | Default value, valid when v-model is empty | _number \| string_ | `1` | | step | Value change step | _number \| string_ | `1` | -| name | Stepper name | _number \| string_ | - | +| name | Stepper name, usually a unique string or number | _number \| string_ | - | | input-width | Input width | _number \| string_ | `32px` | | button-size | Button size | _number \| string_ | `28px` | | decimal-length | Decimal length | _number \| string_ | - | diff --git a/packages/vant/src/stepper/README.zh-CN.md b/packages/vant/src/stepper/README.zh-CN.md index 50e017c5e..beb9e67a9 100644 --- a/packages/vant/src/stepper/README.zh-CN.md +++ b/packages/vant/src/stepper/README.zh-CN.md @@ -148,7 +148,7 @@ export default { | max | 最大值 | _number \| string_ | - | | default-value | 初始值,当 v-model 为空时生效 | _number \| string_ | `1` | | step | 步长,每次点击时改变的值 | _number \| string_ | `1` | -| name | 标识符,可以在 `change` 事件回调参数中获取 | _number \| string_ | - | +| name | 标识符,通常为一个唯一的字符串或数字,可以在 `change` 事件回调参数中获取 | _number \| string_ | - | | input-width | 输入框宽度,默认单位为 `px` | _number \| string_ | `32px` | | button-size | 按钮大小以及输入框高度,默认单位为 `px` | _number \| string_ | `28px` | | decimal-length | 固定显示的小数位数 | _number \| string_ | - | diff --git a/packages/vant/src/swipe-cell/README.md b/packages/vant/src/swipe-cell/README.md index d07a95a88..9be9cecc5 100644 --- a/packages/vant/src/swipe-cell/README.md +++ b/packages/vant/src/swipe-cell/README.md @@ -107,7 +107,7 @@ export default { | Attribute | Description | Type | Default | | --- | --- | --- | --- | -| name | Identifier of SwipeCell | _number \| string_ | - | +| name | Identifier of SwipeCell, usually a unique string or number | _number \| string_ | - | | left-width | Width of the left swipe area | _number \| string_ | `auto` | | right-width | Width of the right swipe area | _number \| string_ | `auto` | | before-close | Callback function before close | _(args) => boolean \| Promise\_ | - | diff --git a/packages/vant/src/swipe-cell/README.zh-CN.md b/packages/vant/src/swipe-cell/README.zh-CN.md index b2a94d9f2..2c430e588 100644 --- a/packages/vant/src/swipe-cell/README.zh-CN.md +++ b/packages/vant/src/swipe-cell/README.zh-CN.md @@ -114,7 +114,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| name | 标识符,可以在事件参数中获取到 | _number \| string_ | `''` | +| name | 标识符,通常为一个唯一的字符串或数字,可以在事件参数中获取到 | _number \| string_ | `''` | | left-width | 指定左侧滑动区域宽度,单位为 `px` | _number \| string_ | `auto` | | right-width | 指定右侧滑动区域宽度,单位为 `px` | _number \| string_ | `auto` | | before-close | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(args) => boolean \| Promise\_ | - | diff --git a/packages/vant/src/uploader/README.md b/packages/vant/src/uploader/README.md index 48be45c20..f4da74b02 100644 --- a/packages/vant/src/uploader/README.md +++ b/packages/vant/src/uploader/README.md @@ -306,7 +306,7 @@ export default { | --- | --- | --- | --- | | v-model | List of uploaded files | _FileListItem[]_ | - | | accept | Accepted [file type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers) | _string_ | `image/*` | -| name | Input name | _number \| string_ | - | +| name | Input name, usually a unique string or number | _number \| string_ | - | | preview-size | Size of preview image | _number \| string \| Array_ | `80px` | | preview-image | Whether to show image preview | _boolean_ | `true` | | preview-full-image | Whether to show full screen image preview when image is clicked | _boolean_ | `true` | diff --git a/packages/vant/src/uploader/README.zh-CN.md b/packages/vant/src/uploader/README.zh-CN.md index 2f0ee5367..1178b4e3c 100644 --- a/packages/vant/src/uploader/README.zh-CN.md +++ b/packages/vant/src/uploader/README.zh-CN.md @@ -327,7 +327,7 @@ export default { | --- | --- | --- | --- | | v-model | 已上传的文件列表 | _FileListItem[]_ | - | | accept | 允许上传的文件类型,[详细说明](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B) | _string_ | `image/*` | -| name | 标识符,可以在回调函数的第二项参数中获取 | _number \| string_ | - | +| name | 标识符,通常为一个唯一的字符串或数字,可以在回调函数的第二项参数中获取 | _number \| string_ | - | | preview-size | 预览图和上传区域的尺寸,默认单位为 `px` | _number \| string \| Array_ | `80px` | | preview-image | 是否在上传完成后展示预览图 | _boolean_ | `true` | | preview-full-image | 是否在点击预览图后展示全屏图片预览 | _boolean_ | `true` |