<el-image
v-for="(image, index) in form.imgUrl"
:key="index"
:src="image"
class="image"
:preview-src-list="privewImages(index)"
alt="图片/音频图片"
>
<div
slot="error"
class="image-slot"
>
<el-image :src="require('@/assets/imgError.png')"></el-image>
</div>
</el-image>
主要方法::preview-src-list="privewImages(index)"
privewImages(index) {
let tempImgList = [...this.form.imgUrl]
// 所有图片地址
if (index == 0) return tempImgList;
// 调整图片顺序,把当前图片放在第一位
let start = tempImgList.splice(index);
let remain = tempImgList.splice(0, index);
return start.concat(remain); // 将当前图片调整成点击缩略图的那张图片
},
标签:tempImgList,el,预览,index,image,let,图片
From: https://www.cnblogs.com/hxy--Tina/p/18317975