Commit ffe5852d by 张杰

优化图片展示

1 parent b3a2b420
......@@ -4,7 +4,7 @@
<div class="img_cell" v-for="(item,index) in imgList" :key="index">
<div class="el_img_box">
<i class="el-icon-error el_icon" @click="removeImage(item)" v-if="readStatus != 1"></i>
<el-image class="el_img" :src="item.path" :preview-src-list="[item.path]"></el-image>
<el-image class="el_img" :src="item.path" :preview-src-list="getPreViewList(item.path)"></el-image>
</div>
</div>
<!-- 图片列表 end -->
......@@ -138,7 +138,7 @@ export default {
removeImage(row) {
//数组中删除对应img
this.imgList = this.imgList.filter((k) => k.path != row.path);
console.log(this.imgList)
console.log(this.imgList);
this.$emit("input", this.imgList);
// 删除存量图片
......@@ -157,6 +157,20 @@ export default {
}
return true;
},
// 获取图片预览列表
getPreViewList(url) {
let list = this.imgList || [];
let arr = [];
list.map((k) => {
if (k.path != url) {
arr.psuh(k.path);
}
});
arr.unshift(url);
console.log(arr);
return arr;
},
},
};
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!