After vue uploads pictures using element-ui, the file list cannot be cleared with this.$refs.upload.clearFiles ()

create the form. After uploading the picture, the form is created successfully. Next time, the form is empty, but the picture is still retained and the last uploaded picture is not empty. Using this.$refs.upload.clearFiles (); does not take effect. Excuse me, how to solve this problem

Mar.22,2021

1. Confirm that the method does not support calling
2 in before-upload. The name "upload" of ref is correct


: file-list= "fileList"
the fileList array bound here is cleared, so there is no content


.
const mainImg = this.$refs.upload;
  if (mainImg && mainImg.length) {
    mainImg.forEach(item => {
    // item.uploadFiles.length = 0;
      item.clearFiles();
    });
  }

multiple upload, so clear the original file

Menu