vue iview modal弹出框 form表单验证

一、html

二、规则

三、

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

猜你喜欢

转载自www.cnblogs.com/wangdashi/p/9453097.html