element图片回显是通过修改file-list属性的url属性实现的。
<!-- 图片上传 --> <el-form-item label="景区图片" prop="s_img"> <el-upload list-type="picture-card" :action="网址" :on-change="handleChange" :before-remove="beforeRemove" :on-preview="handlePictureCardPreview" fit="cover" :file-list="绑定值" multiple :limit="1" name="file" > <el-icon class="avatar-uploader-icon"> <Plus /> </el-icon> </el-upload> <el-dialog v-model="dialogVisibles" width="300"> <img w-full :src="dialogImageUrl" alt="Preview Image" style="width: 80%; margin: auto" /> </el-dialog> </el-form-item>
回显:
绑定值 = [ { url: 图片路径, } ];