zoukankan      html  css  js  c++  java
  • elementUI 上传多图

    <el-upload
              :action="$store.state.baseURL+'/commonFile/upload.do'"
              list-type="picture-card"
              :on-success="handleSuccess"
              :on-preview="handlePictureCardPreview"
              :file-list="fileList"
              :on-remove="handleRemove">
           <i class="el-icon-plus"></i>
      </el-upload>
       <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="">
       </el-dialog>
     
     
     
    // 文件上传成功
            handleSuccess(response, file, fileList) {
                console.log(file)
                 console.log(fileList)
                this.fileList = fileList.map(res => {
                    if(res.raw) {
                        return {
                            name: res.name,
                            id: res.response.data,
                            status: res.status,
                            raw: res.raw,
                            url: res.url
                        } 
                    }else {
                        return {
                            name: res.name,
                            id: res.id,
                            status: res.status,
                            url: res.url
                        }
                    }
                })
                console.log(this.fileList)
            },
     
    handlePictureCardPreview(file) {
                console.log(file)
                this.dialogImageUrl = file.url;
                this.dialogVisible = true;
            }
     
     
     handleRemove(file, fileList) {
                console.log(file)
                console.log(fileList)
                this.fileList = fileList;
            },
  • 相关阅读:
    安卓开发遇到的报错信息
    工作记录
    答辩系统问题
    DWR
    前端vue 里的tab切换 减少dom操作
    前端拖动div 效果
    vue 点击按钮弹窗,点击关闭按钮关闭弹窗。
    前段开发 jq ajax数据处理详细讲解。
    vue计算属性computed和methods的区别
    前段开发 react native tab功能
  • 原文地址:https://www.cnblogs.com/lucy1111/p/13387907.html
Copyright © 2011-2022 走看看