【问题标题】:I want to use "el-upload" to upload images and documents, but I want to display the images我想使用“el-upload”来上传图片和文档,但我想显示图片
【发布时间】:2022-07-27 11:25:15
【问题描述】:

我想使用“el-upload”来上传图片和文档,但我想显示图片。如果使用“list-type='picture-card'”,文档也会显示不正确的封面。那么有什么方法可以上传显示图像缩略图的文件,显示名称的文档? enter image description here

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: element


【解决方案1】:
<el-upload
     action=""
     ref="upload"
     :auto-upload="false"
     :on-change="onchange">
  <el-button slot="trigger" size="small" type="primary">Click to Upload</el-button>
 </el-upload>
 <el-image 
    style="width: 100px; height: 100px"
    :src="fileList[0]" 
    :preview-src-list="fileList">
  </el-image>

data() {
  return {
   fileList: []
 }
}, methods: {
   onchange(file, fileList){
     this.fileList.push(URL.createObjectURL(file.raw))
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 2022-11-22
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    • 2022-12-04
    • 2021-11-16
    相关资源
    最近更新 更多