上传照片 <el-upload ref="upload" :file-list="fileList" action="#" :auto-upload="false" :on-change="handleC
@click="handlePictureCardPreview(file)" > </el-upload> // 图片查看器 <el-image-viewer v-if="showViewer" :initial-index="this.index" :on-close="closeViewer" :url-list="this.urlList" /> 2、声明 showViewer: false, // 显示查看器 urlList: [], // 图片的...
1、组件的封装MultipleImgUpload <template><el-uploadaction="#"list-type="picture-card":show-file-list="false":http-request="handleUploadRequest":limit='5'></el-upload>TIPS:(最多可以上传5张图片,双击可删除)</template>import { fileUploadOne } from "@/api/cbd.js" export default { name: ...
选择图片
reader.onload=function(oFREvent) {// 预览图片代码document.querySelector("#uploadPreview").src= oFREvent.target.result; } reader.readAsDataURL(newfile) FileReader对象允许 Web 应用程序异步读取存储在用户计算机上的文件(或原始数据缓冲区)的内容,使用 File 或 Blob 对象指定要读取的文件或数据。