Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VVerificationCode组件校验事件不生效 #45

Closed
ousinka opened this issue Oct 27, 2021 · 1 comment
Closed

VVerificationCode组件校验事件不生效 #45

ousinka opened this issue Oct 27, 2021 · 1 comment

Comments

@ousinka
Copy link
Contributor

ousinka commented Oct 27, 2021

// 执行自定义校验
      const handleCustomValidator = () => {
        return new Promise((resolve) => {
          this.__eventHandler('verification-code-valid', async (callback) => {
            if (isFunction(callback)) {
              const valid = await callback(this.VFormRoot)
              if (valid === false) resolve(false)
            }
          })
          resolve(true)
        })
      }

handleCustomValidator 返回结果总是为true,外部callback返回值不生效

@ousinka
Copy link
Contributor Author

ousinka commented Oct 27, 2021

if (type === 'verification-code-valid') {
        value(async (formRoot) => {
          // 返回 true 代表通过,开始倒计时;false 则不执行
          return false
        })
      }

测试发现return false时无效,依然触发倒计时

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant