方法一:利用promise
        var p1=new Promise(function(resolve, reject) {
        
            this.$refs[form1].validate((valid) => {
                if(valid){
                    resolve();
                }
            })
        });
        
        var p2=new Promise(function(resolve, reject) {
             this.$refs[form2].validate((valid) => {
              if(valid){
                resolve();
              }
            })
        });
        
        
        
        Promise.all([p2,p1]).then(function(){
            alert("验证通过了");
        });
方法2:开关的方式
        this.$refs[a].validate((valid) => {
         
                if (valid) {
                  this.titleFormValid = true
                }
              })
               this.$refs[b].validate((valid) => {
                    if(valid){
                       this.customFormValid = true
                    } 
                })
               if (this.titleFormValid && this.customFormValid) {
                 alert("保存成功")
               }
              }

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
  • 2022-01-22
猜你喜欢
  • 2021-08-08
  • 2022-12-23
  • 2021-07-11
  • 2021-09-05
  • 2021-11-25
  • 2021-05-23
  • 2021-11-03
相关资源
相似解决方案