来自:https://github.com/ElemeFE/element/issues/3367#issuecomment-376402380 侵删
el-upload里面绑定一个占位class:
:class="{hide:hideUpload}"
data里面初始值:
hideUpload: false,
limitCount:1
onChange里面(添加文件、上传成功和上传失败时都会被调用的那个):
this.hideUpload = fileList.length >= this.limitCount;
handleRemove里面(删除文件被调用的那个):
this.hideUpload = fileList.length >= this.limitCount;
style,把scoped去掉(或者外部引入样式文件,主要目的是为了修改element-ui自带的样式)
<style>
.hide .el-upload--picture-card {
display: none;
}
</style>
原文地址:https://www.cnblogs.com/lhqdbk/p/11718032.html
时间: 2024-10-01 13:03:22