如何使用
引入
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../dist/script/ux-form.js"></script>
html
<div class="container">
<div>
<label>姓名<input type="text" name="name" /></label>
</div>
</div>
javascript
var nameFormControl = uxForm.FormControl.create($('[name=name]'), {
required: true,
rules: {
maxLength: 20
},
patterns: {
maxLength: 20
}
});
nameFormControl.obs.on('onCheck',function(){
console.log(nameFormControl.getStatus());
});