iview 表单动态校验,required: true


                                            
                                        
this.showName = false;
            this.$nextTick(()=>{
                this.showName = true;
            })
            this.dataConfig.name = '';
            this.ruleValidate.name = []
            if(val=='NS'){
                this.ruleValidate.name = [{ validator: (rule, value, callback)=>{
                    if(!isEmpty(value)&&this.dataConfig.type!='NS'){
                        callback(new Error('请输入主机记录'));
                    }else{
                        callback();
                    }
                },trigger: 'blur' }]
            }else{
                this.ruleValidate.name = [{ required: true,message: '请输入主机记录' ,trigger: 'blur' }]
            }

 

你可能感兴趣的:(框架库点滴知识)