handleSave() {
let list = [];
list.push(
this.checkForm("oneRef"),
this.checkForm("twoRef"),
this.checkForm("threeRef"),
this.checkForm("fourRef"),
this.checkForm("fiveRef"),
this.checkForm("sixRef"),
);
Promise.all(list)
.then(() => {
console.log("表单验证通过");
})
.catch(() => {
console.log("表单验证通过");
});
},
//多个表单同时验证
checkForm(formName) {
return new Promise((resolve, reject) => {
this.$refs[formName].validate(valid => {
if (valid) {
resolve();
} else reject();
});
});
},
element多个表单同时验证
最新推荐文章于 2024-06-14 11:07:57 发布