vue iview modal弹出框 form表单验证


一、ref="addApply" :model="addApply" :rules="ruleValidate"   不要忘记prop

 

二、规则

三、

 
 
_createApply(name){
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        let addApply = Object.assign({},this.addApply)
                        addApply.serviceEndDate = formatDate(new Date(addApply.serviceEndDate),'yyyy-MM-dd')
                        createApply(addApply).then(res=>{
                            if(res.data.errcode ===0){
                                this.dialogAdd = false
                                this.$Message.info('创建成功!')
                                this._getApplyList()
                                this.$refs[name].resetFields();
                            } else if(res.data.errcode === 40199){
                                this.$Message.error('创建失败,该书库应用已存在!')
                            }
                        })
                    }
                }) 
            },
cancleSubmit(name){
                this.$refs[name].resetFields();
            },

 

 四、效果图

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM