vue一个界面有两个form表单如何进行校验
可利用Promise异步控制const rule1 = new Promise((resolve,reject) => {this.$refs['xuForm'].validate(valid => {if(valid){resolve()}else{...
·
可利用Promise异步控制
const rule1 = new Promise((resolve,reject) => {
this.$refs['xuForm'].validate(valid => {
if(valid){
resolve()
}else{
// reject('error submit!!')
console.log("error submit!!");
return false;
}
})
})
const rule2 = new Promise((resolve,reject) => {
this.$refs['jiaoForm'].validate(valid => {
if(valid){
resolve()
}else{
console.log("error submit!!");
return false;
}
})
})
Promise.all([rule1,rule2]).then(() =>{
//进行的操作
})
更多推荐
已为社区贡献5条内容
所有评论(0)