🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 表单验证 表单验证依赖插件 [http://www.formvalidator.net/#default-validators_custom](http://www.formvalidator.net/#default-validators_custom) ![](https://box.kancloud.cn/18f5bc437e4b61b89c0fcfa761135fbd_530x438.png) ``` <form action="" method="post" class="form-horizontal" id="registration-form"> <div class="form-group"> <label class="col-sm-2 control-label">邮箱</label> <div class="col-sm-10"> <input data-validation="email" data-validation-error-msg="请输入邮箱"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">帐号</label> <div class="col-sm-10"> <input data-validation="custom" data-validation-regexp="^[a-z]{3,}$" data-validation-error-msg="用户名由3位以上字母构成"> </div> </div> <div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <button class="btn btn-primary">保存</button> </div> </div> </form> <script> require(['hdjs','bootstrap'], function (hdjs) { hdjs.validate(); }); </script> ```