element-ui upload文件上传,清空文件列表

1.上传组件中需要绑定ref属性 ref="upload"

                  <el-upload
                    ref="upload"
                    action="http://localhost:8082/api/Product/imageUpload"
                    :data="ProductImageUploadData"
                    :on-success="getImageByProductId"
                    accept=".png,.jpg,.gif,jpeg,.bmp"
                    list-type="picture-card"
                    :multiple="true"
                    :on-preview="handlePictureCardPreview"
                    :on-remove="handleRemove">
                    <i class="el-icon-plus"></i>
                  </el-upload>

2.在对应的函数中使用

 this.$refs.upload.clearFiles()

即可清空

posted @ 2021-12-20 22:28  成强  阅读(2658)  评论(0编辑  收藏  举报