element 同时校验循环遍历的多个表单
<div v-for="(arg, index) in list" :key="index"> <el-form ref="`form-${index + 1}`" :model="arg"></el-form> </div>
let count = 0 list.forEach((v, i) => { this.$refs[`form-${i+1}`].validate(valid => { if (valid) { count++ } }) }) if (count === list.length) { alert('校验通过') }