vbenjs / vue-vben-admin

A modern vue admin panel built with Vue3, Shadcn UI, Vite, TypeScript, and Monorepo. It's fast!
https://www.vben.pro
MIT License
25.48k stars 6.93k forks source link

提问帖:VbenPinInput button 禁用或者二次快速验证实现方案 #4850

Closed tiandiweizun closed 2 weeks ago

tiandiweizun commented 2 weeks ago

Version

Vben Admin V5

Describe the bug?

手机号登录的时候,当输入的手机号不满足位数或者邮箱输入的格式错误的时候,手机号或者邮箱为VbenInput,而验证码为VbenPinInput,测试发现设置dependencies的disabled无效,而只能在handleSendCode再做一次验证,那么还有更加方便的办法吗,如果再做一次验证的话可以有简单的formapi.validatefield实现吗?能否贴上代码帮忙一下。

Reproduction

const formSchema = computed((): VbenFormSchema[] => { return [ { component: 'VbenInput', componentProps: { placeholder: 'example@example.com', }, fieldName: 'email', label: $t('authentication.email'), rules: z .string() .min(1, { message: $t('authentication.emailTip') }) .email($t('authentication.emailValidErrorTip')), }, { component: 'VbenPinInput', componentProps: { disabled: true, handleSendCode: () => { message.success('发送验证码成功!'); }, maxTime: 10, createText: (countdown: number) => { const text = countdown > 0 ? $t('authentication.sendText', [countdown]) : $t('authentication.sendCode'); return text; }, },

System Info

commitid:9cf0573921b45e71a9e82c70af8c34e7428020d4  ,提交于2024-11-09

Relevant log output

No response

Validations

anncwb commented 2 weeks ago

dependencies 的 disabled 可以支持了。