weixin_41359495
H_Franky
采纳率23.3%
2021-03-01 20:01

vue el-upload上传图片编辑时怎么回显?

5
已结题

在添加时正常,但在编辑时,后端返回了图片url,我怎么把它显示上去?(添加时不是立刻上传的,而是用file.url暂时展示的,后面手动提交才上传)

 

<el-upload class="upload-box" action="" list-type="picture-card" :auto-upload="false" :limit="3" :on-exceed="handleExceed" :on-change="uploadChange" ref="upload">
    <i slot="default" class="el-icon-plus"></i>
    <div slot="file" slot-scope="{file}">
        <img class="el-upload-list__item-thumbnail" :src="file.url">
        <span class="el-upload-list__item-actions">
           <span class="el-upload-list__item-preview" @click="handlePreview(file)">
               <i class="el-icon-zoom-in"></i>
           </span>
           <span class="el-upload-list__item-delete" @click="handleRemove(file)">
                <i class="el-icon-delete"></i>
           </span>
         </span>
     </div>
</el-upload>
  • 点赞
  • 收藏
  • 复制链接分享

2条回答

  • weixin_43551840 我爱吃西瓜喵 1月前

    你把返回的url赋到img的src上

    点赞 评论 复制链接分享
  • zhshchilss zhshchilss 1月前

    看api啊,官网的例子看一遍都会了。你要他显示,你得把文件list给他吧

    点赞 评论 复制链接分享