<el-upload
:action="action"
:accept="'image/*'"
list-type="picture-card"
:file-list="filelist"
:on-preview="handlePictureCardPreview"
:before-remove="beforeRemove"
:class="{disabled:uploadDisabled}">
<i class="el-icon-plus"></i>
</el-upload>
<script>
....
computed:{
// 限制只上传两张
uploadDisabled(){
return this.filelist.length > 1
}
}
....
</script>
<style>
.disabled .el-upload--picture-card {
display: none;
}
</style>
el-upload 限制图片上传的方法
最新推荐文章于 2024-08-15 15:35:32 发布