一、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();
},
四、效果圖


