el-upload 组件确实不支持自动更新 file-list,需要手动在上传成功和删除的回调中处理文件列表同步。

无奈只能手动实现,设置 on-success 和 on-remove 的回调处理。

<el-upload
   :action="uploadUrl"
   accept="image/jpeg,image/png"
   multiple
   :limit="5"
   :data="uploadConfig"
   :on-remove="(file, fileList) => { return handleRemoveByLogo1(file, fileList, 1); }"
   :before-remove="beforeRemove1"
   :before-upload="beforeUploadByLogo"
   :on-exceed="handleExceed"
   :on-preview="handlePreview1"
   :on-success="(res, file, files) => { return handleSuccessLogo1(res, file, files, 1); }"
   :file-list="imgJson[1].fileList"
   list-type="picture-card">
      <img src="./img/camera.png" />
      <span>拍照确认</span>
</el-upload>

注意: 

el-upload手动修改file-list之后无法一次上传多张照片会报 

Uncaught TypeError: Cannot set property 'status' of null

GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45 8 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 8 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐