<el-upload
:action="https://www.upload.baidu.com"
list-type="picture-card"
:class="{ disabled: uploadDisabled }"
:limit="1"
:on-success="handleAvatarSuccess"
:on-change="handleChange"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
data() {
return {
uploadDisabled:false,
}
},
methods: {
handleChange(file,fileList){
if(fileList.length >= 1){
this.uploadDisabled = true;
}
},
handleAvatarSuccess(response) {
window.console.log(response);
},
handleRemove(file) {
this.uploadDisabled = false;
}
},
<style>
.disabled .el-upload--picture-card {
display: none !important;
}
</style>