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

表单验证文档中的代码参数不对 #23

Open
lichenliang666 opened this issue Sep 30, 2019 · 1 comment
Open

表单验证文档中的代码参数不对 #23

lichenliang666 opened this issue Sep 30, 2019 · 1 comment

Comments

@lichenliang666
Copy link

下面这个表单验证的文档中有错误
https://github.com/skyvow/wx-extend/blob/master/docs/components/validate.md

下面这段代码有两个问题:
1、这行注释 // 调用验证方法,传入参数 e 是 form 表单组件中的数据 ,描述的内容违背了惯例,容易让人误解,常规情况下 submitForm(e) 中的 e 是form的提交事件;
2、代码中的 WxValidate.checkForm(e) 的 参数 e 不对,应该是 e.detail.value

// 调用验证方法,传入参数 e 是 form 表单组件中的数据
submitForm(e) {
    const params = e.detail.value

    console.log(params)

    // 传入表单数据,调用验证方法
    if (!this.WxValidate.checkForm(e)) {
        const error = this.WxValidate.errorList[0]
        return false
    }
},


@slowlydd
Copy link

slowlydd commented Jun 7, 2021

确实,我也遇到了,应修改为
this.WxValidate.checkForm(params)

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

2 participants