element ui文档中没有明确说明如何自定义上传图片后显示效果,可以通过css的object-fit来控制图片展示效果
css object-fit相关属性说明
英文:https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
中文:https://element.eleme.cn/#/zh-CN/component/image
代码示例
<el-upload
:action="uploadUrl"
:data="uploadKey"
list-type="picture-card"
:file-list="addform.img_list"
:on-success="up_dt_success"
:on-remove="up_dt_remove"
:on-preview="up_img_preview"
>
<i slot="default" class="el-icon-plus"></i>
</el-upload>
<style>
.el-upload-list__item-thumbnail {
/* 图片在方框内显示长边 */
object-fit: contain;
}
</style>