element-ui上传一张图片后隐藏上传按钮

来自: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>

 

posted @ 2019-05-22 14:33  abcByme  阅读(8827)  评论(0编辑  收藏  举报