We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
原理是,通过正则表达式去验证,不通过抛出配置文件对应的错误信息。 它有内置验证,比如phoneno,代表验证手机号;支持自己传入正则表达式,类型reg;支持传入部分验证规则,比如类型string,传入长度验证。
原理是,传输待校验的表单json数据对象,通过name字段匹配到formRule.config.js里的验证规则,graceChecker根据校验类型checkType,执行内置或传入的检验规则checkRule
import graceChecker from '@/common/graceChecker.js' import formRuleConfig from '@/config/formRule.config.js' export default { onLoad(){ this.checkForm = {phoneNo:"18120119568",code:1223} let checkRes = graceChecker.check(this.checkForm, formRuleConfig.sendCodeRule); if (!checkRes) { uni.showToast({ title: graceChecker.error, icon: "none" }); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
表单校验
文件简解
1. graceChecker.js
2. formRule.config.js
3.代码示例
反馈与建议
The text was updated successfully, but these errors were encountered: