mp-form表单rules校验失效了?
今天写表单的时候发现rules校验一直不生效,不管填没填信息,valid返回都是true,我以为是我写错了,可是看了一下之前写的也无法校验了,你们有这种情况吗?
<mp-form id="form" rules="{{rules}}" models="{{formData}}">
<mp-cells>
<mp-cell prop="business" title="营业执照" ext-class="" >
<input wx:if="{{!formData.image}}" bindtap="chooseimage" disabled="true" value="{{formData.business}}" data-field="business" class="weui-input" placeholder="点击选择营业执照" />
<image wx:if="{{formData.image}}" bindtap="chooseimage" src="{{formData.image}}" mode="widthFix" class="img_business"></image>
</mp-cell>
<mp-cell prop="identiry" title="法人身份证" ext-class="">
<input bindinput="formInputChange" value="{{formData.identiry}}" data-field="identiry" class="weui-input" placeholder="请输入法人身份证" />
</mp-cell>
<mp-cell prop="name" title="法人姓名" ext-class="">
<input bindinput="formInputChange" value="{{formData.name}}" data-field="name" class="weui-input" placeholder="请输入法人姓名" />
</mp-cell>
<mp-cell prop="tel" title="法人电话" ext-class="">
<input bindinput="formInputChange" value="{{formData.tel}}" data-field="tel" class="weui-input" placeholder="请输入手机号码" />
</mp-cell>
</mp-cells>
</mp-form>
data:{
formData: {
},
rules: [{
business: '营业执照',
identiry: '法人身份证',
name: '法人姓名',
tel: '法人电话',
}]
}
1 回复
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。