<el-upload
:file-list="pcodeList"
action="https://bigdata.86wky.com/api/back/Index/uploadQr"
:headers="{'token': token}"
list-type="picture-card"
:before-upload="uploadBefore"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-success="upSuccess"
:class="{hide:hideUpload}"
>
<i class="el-icon-plus"></i>
</el-upload>
el-upload里面绑定一个占位class:
:class="{hide:hideUpload}"
data里面初始值:
hideUpload: false,
onChange里面(添加文件、上传成功和上传失败时都会被调用的那个):
this.hideUpload = fileList.length >= this.limitCount;
或
this.hideUpload = true
handleRemove里面(删除文件被调用的那个):
this.hideUpload = fileList.length >= this.limitCount;
或
this.hideUpload = false
style,有scoped用样式穿透
<style scoped>
/deep/.hide .el-upload--picture-card {
display: none;
}
</style>