要素のアップロード上传报错キャッチされない例外TypeError:未定義のできない一連のプロパティ「状態」

その理由は、与えられた:セットアップ:ファイルリスト=「のfileList」、意志エラーとしてファイルリストのない一連のプロパティ「状態」することができ 、未定義読み取り専用で、変更
ソリューション:setTimeoutを成功コールバックリストによってアップロードされ、空を解決することができます。
以下のコード
`html <el-upload style="margin:10px 0 0 0;width:90%" class="upload-demo" ref="upload" :on-success="success" :action='url"' :data="icon" :auto-upload="false" accept=".jpg, .png, .jpeg" :headers="headers" :on-change="onchangeupload" :on-remove="onremove" :file-list="fileList"> <el-button slot="trigger" size="small" type="primary">{{$t('message.SelectFile')}}</el-button> </el-upload>

//成功回调
uploadsuccess (res) {
      if (res.code == "200") {
        this.$message({
          showClose: true,
          message: res.message,
          type: "success"
        })
//-----------------------------------
//解决关键代码:使用延时器清空上传文件列表和自定义参数,
      setTimeout(()=>{
        this.uploadfile=false
        this.icon={}
        this.$refs.upload.clearFiles()
      },100)
//------------------------------------
      } else {
        this.$message({
          showClose: true,
          message: res.message,
          type: "error"
        })
      }

    },
//失败回调
    uploaderror (res) {
      this.$message({
        showClose: true,
        message: res.message,
        type: "error"
      })
    },
//打开弹框
      showUploadLogShow(val){
        this.uploadLog=true
        this.isUpload=val.isUpload
        this.fileTypeobj={
          fileType:"licenseFile",
          fileId:val.fileId,
          id:val.id
        }
      },
//删除文件回调
 onremove(val,list){
        if(list.length==0){
          this.uploadfile=false
        }else{
          this.uploadfile=true
        }
      },
      onchangeupload(val,list){
        this.fileList = list.slice(-1);//只上传一个文件,自动更换最新选择文件
        if(list.length==0){
          this.uploadfile=false
        }else{
          this.uploadfile=true
        }
      },
//触发上传
      trueload() { 
        if(this.uploadfile){
           if(this.isUpload){ 
           this.$confirm(this.$t('message.xukewenjaincunzai'),this.$t('message.Tips'), {
                confirmButtonText:this.$t('message.Ok'),
                cancelButtonText: this.$t('message.Cancel'),
                type: 'warning'
              }).then(() => {
                  this.$refs.upload.submit()
                    this.uploadLog = false
                    this.getData()
            }).catch(()=>{
                  this.$message({
                    showClose: true,
                    message:this.$t('message.Cancelupload'),
                  })
                  this.uploadLog = false
                })
            }else{
              this.$refs.upload.submit()
              this.uploadLog = false
              this.getData()
          }
        }else{
          this.$message({
              showClose: true,
              message:this.$t('message.Pleaseselectuploadfile'),
              type: "error"
            })
        }
      },


おすすめ

転載: www.cnblogs.com/FormerWhite/p/12486411.html