bug描述: uniapp使用uview开发app过程中,表单触发验证红字提示必填项;但在必填项写入后,红字提示依然存在。
解决代码:
<u-form-item
label="xxxx"
prop="faultTypeName"
borderBottom
:required="true"
>
<u-picker :show="faultTypeShow" keyName="dictLabel" :columns="faultTypeList"
@confirm="faultTypeConfirm" @change="changeHandler"
@cancel="faultTypeShow = false;">
</u-picker>
//核心方法
clearValidate(props){
this.$refs['uForm'].clearValidate(props);
},
//在触发faultTypeName更改的函数内调用clearValidate。
faultTypeConfirm(e){
this.model.faultTypeName = e.value[0].dictLabel;
this.model.faultType = e.value[0].dictValue;
this.clearVal("faultTypeName");
this.faultTypeShow = false;
},
over