<el-form-item label="上传库房布局图片" prop="picUrl"> <el-upload class="avatar-uploader" accept="image/*" :headers="headers" :action="minioUploadApi" :show-file-list="false" :on-success="handleAvatarSuccessUpdate" :before-upload="beforeAvatarUpload" :limit="limitCount" :on-remove="(file, fileList)=>picsRemove('1',file, fileList)" > <img v-if="imageUrl" :src="formUpdate.picUrl" class="avatar"> <i v-else class="el-icon-plus avatar-uploader-icon" /> </el-upload> </el-form-item> 改写成只能上传单张图片并可覆盖上传
时间: 2024-04-10 19:29:20 浏览: 172
单张图片上传
<-form-item label="上传库房布局图片" prop="picUrl">
<el-upload
class="avatar-uploader"
accept="image/*"
:headers="headers"
:action="minioUploadApi"
:show-file-list="false"
:on-success="handleAvatarSuccessUpdate"
:before-upload="beforeAvatarUpload"
:limit="1"
:on-remove="(file, fileList)=>picsRemove('1', file, fileList)"
>
<img v-if="imageUrl" :src="formUpdate.picUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item>
上述代码将限制用户只能上传单张图片,并且可以使用新上传的图片覆盖之前的图片。
阅读全文