element - el-form多个表单需同时校验
element - el-form多个表单需同时校验
refs
this.$refs[('form1', 'form2', ...)].validate((valid, obj) => {})
Promise.all
// 当前弹框form校验
const p1 = new Promise((resolve, reject) => {
this.$refs["form"].validate((valid) => {
if (valid) resolve();
});
});
// 数据源组件form校验
const p2 = new Promise((resolve, reject) => {
this.$refs["ComTemplateDataSourceRef"].$refs["form"].validate(
(valid) => {
if (valid) resolve();
}
);
});
// 格式化组件form校验
const p3 = new Promise((resolve, reject) => {
this.$refs["ComTemplateFormatRef"].$refs["form"].validate((valid) => {
if (valid) resolve();
});
});
Promise.all([p1, p2, p3]).then(async () => {
// 做处理
});
Lee2