<el-form-item label="状态:"prop="zt"class="bitianxian"><el-select v-model="ruleForm.zt"placeholder="请选择"@change="emptyztXM()"><el-option v-for="(item,index) in ZTdata":key="index":label="item.label":value="item.value"></el-option></el-select></el-form-item><el-form-item label="XXX:":prop="ruleForm.zt=== 1 ? 'byclsl' : 'empty'" ><el-input v-model="ruleForm.byclsl"v-input.float@input="yanzhegn($event,'byclsl')"placeholder="请输入"></el-input></el-form-item><el-form-item label="BBBB:":prop="ruleForm.zt==1?'zgrcll':'empty'" ><el-input v-model.trim="ruleForm.zgrcll"v-input.float@input="yanzhegn($event,'zgrcll')"placeholder="请输入"></el-input></el-form-item>
data
rules: {zt: [{ validator: reg_xiala, required: true }],byclsl: [{ validator: reg_kong, required: true }],zgrcll: [{ validator: reg_kong, required: true }],}
methods
yanzhegn(event,yzname){if(event.length > 0){this.$refs.ruleForm.clearValidate(yzname);}else{this.$refs.ruleForm.validateField(yzname);}},emptyztXM() {console.log(this.ruleForm.zt != 1)if (this.ruleForm.zt != 1) {this.$refs.ruleForm.clearValidate('byclsl');this.$refs.ruleForm.clearValidate('zgrcll');}},