<el-image style="width: 100%; height: 100%" :src="item.imgUrl" :preview-src-list="[item.imgUrl]"
@click.stop="handlePreviewImg(item)" />
// 预览照片
async handlePreviewImg(item) {
this.viewData.power = item.power;
this.viewData.pictureId = item.id;
this.viewData.departmentName = sessionStorage.getItem('departmentName');
this.viewData.userName = sessionStorage.getItem('loginName');
this.viewData.userId = sessionStorage.getItem('userId');
let res = await ViewApi.saveViewDetail(this.viewData);
if(res && res.code == '10000' && res.resultFlag) {
// 图片浏览成功
}
this.$nextTick(() => {
let domImageView = document.querySelector(".el-image-viewer__mask"); // 获取遮罩层dom
let closeEle = document.querySelector(".el-image-viewer__close"); // 获取遮罩层关闭按钮dom
if (!domImageView || !closeEle) {
return;
}
domImageView.addEventListener("click", () => {
console.log('点击了遮罩层');
// 页面刷新
this.handleImagePage(this.activeObj.layers, this.activeObj.id);
});
closeEle.addEventListener("click", () => {
console.log('点击了关闭按钮');
// 页面刷新
this.handleImagePage(this.activeObj.layers, this.activeObj.id);
});
});
}
el-image 的关闭事件
最新推荐文章于 2024-07-24 15:48:10 发布