压缩图片的递归方法

    authJob(n){
      if (n<=0) {
        return 
      }else{
      
          this.rpc.load.authJob(this.fileList[n-1].raw)
              .then((res) => {
               this.outerFileList.push(res)
                if (n-1==0) {
                  this.$emit("fromchild", this.outerFileList);
                  console.log(this.outerFileList,"-------wenjijan");
                  this.outerFileList = []
                  this.$refs.uploadImport.clearFiles();
                  this.dialogVisible = false;
                  this.loading=false
                  return
                }
                // this.fileCountSuccess++
                // this.fileList.push(res);
                // console.log(this.fileCountBefore,"qian");
                // console.log(this.fileCountSuccess,"完");
        
                // if(this.fileCountBefore==this.fileCountSuccess){
                //   this.loading=false
                // }
                 return this.authJob(n-1)
              })
              .catch((err) => {
                // this.$refs.uploadImport.uploadFiles.splice(idx, 1)
              });
       
      }
    },

  

posted @ 2024-04-01 09:56  小白字太白  阅读(3)  评论(0编辑  收藏  举报