Skip to content

Commit

Permalink
docs(auto-complete): correct rules type
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Sep 14, 2024
1 parent 0a1f711 commit 9553ef4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/auto-complete/docs/zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function useAutoComplete() {
| `readonly` | 是否只读 | _boolean_ | `false` |
| `disabled` | 是否禁用 | _boolean_ | `false` |
| `validate-trigger` | 触发验证的时机,可选值为 `onFocus` `onBlur` `onChange` `onClick` `onClear` `onInput` | _AutoCompleteValidateTrigger[]_ | `['onInput', 'onClear', 'onChange']` |
| `rules` | 验证规则,返回 `true` 表示验证通过,其余的值则转换为文本作为用户提示 | _Array<(v: string) => any>_ | `-` |
| `rules` | 验证规则,返回 `true` 表示验证通过,其余的值则转换为文本作为用户提示 | _(v: string) => any \| ZodType \| Array<(v: string) => any \| ZodType>_ | `-` |
| `enterkeyhint` | 定制回车键样式,参见 [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint) | _string_ | `-` |
| `clearable` | 是否可清除 | _boolean_ | `false` |
| `line` | 是否显示分割线 | _boolean_ | `true` |
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/radio-group/docs/zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const value = ref(false)
<template>
<var-radio
v-model="value"
:rules="z.boolean().refine((v) => v, { message: '请勾选' })"
:rules="z.boolean().refine((v) => v, '请勾选')"
>
当前的值: {{ value }}
</var-radio>
Expand Down
7 changes: 2 additions & 5 deletions packages/varlet-ui/src/radio-group/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ onThemeChange()
</var-radio>

<app-type>{{ t('radioValidateWithZod') }}</app-type>
<var-radio v-model="value10" :rules="z.boolean().refine((v) => v, { message: t('radioValidateMessage') })">
<var-radio v-model="value10" :rules="z.boolean().refine((v) => v, t('radioValidateMessage'))">
{{ t('currentValue') }} {{ value10 }}
</var-radio>

Expand All @@ -115,10 +115,7 @@ onThemeChange()
<div class="relation">{{ t('currentValue') }} {{ value8 }}</div>

<app-type>{{ t('radioGroupValidateWithZod') }}</app-type>
<var-radio-group
v-model="value11"
:rules="z.number().refine((v) => v === 0, { message: t('radioGroupValidateMessage') })"
>
<var-radio-group v-model="value11" :rules="z.number().refine((v) => v === 0, t('radioGroupValidateMessage'))">
<var-radio :checked-value="0">{{ t('eat') }}</var-radio>
<var-radio :checked-value="1">{{ t('sleep') }}</var-radio>
</var-radio-group>
Expand Down

0 comments on commit 9553ef4

Please sign in to comment.